Project.vue 904 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <mesh name="Cube" :position="position">
  3. <geometry type="Box" :args="[size.x, size.y, size.z]" />
  4. <material type="MeshBasic" :color="color" :options="opts" />
  5. </mesh>
  6. </template>
  7. <script>
  8. import * as THREE from 'three'
  9. export default {
  10. name: 'Project',
  11. // mixins: [Object3D],
  12. // props: { size: Object, texture: String, position: Object, color: Number },
  13. props: { data: Object, len: Number, index: Number },
  14. data: () => ({
  15. opts: {
  16. side: THREE.DoubleSide,
  17. wireframe: false,
  18. transparent: true,
  19. opacity: 0.6
  20. },
  21. size: { x: 10, y: 10, z: 10 },
  22. position: { x: 5, y: 5, z: 0 },
  23. color: 0xffffff
  24. }),
  25. created () {
  26. console.log('this.index', this.index)
  27. this.size.y = 20 + Math.random() * 90
  28. this.position.y = -10 + Math.random() * this.size.y / 2
  29. this.position.x = -this.len / 2 * 15 + 15 * this.index
  30. }
  31. }
  32. </script>