|
68 | 68 | scene.background = THREE.Color.new(setcolor)
|
69 | 69 | scene.fog = THREE.Fog.new(setcolor, 2.5, 3.5);
|
70 | 70 |
|
71 |
| -sceneGruop = THREE.Object3D.new(); |
72 |
| -particularGruop = THREE.Object3D.new(); |
| 71 | +sceneGroup = THREE.Object3D.new(); |
| 72 | +particularGroup = THREE.Object3D.new(); |
73 | 73 |
|
74 | 74 | def mathRandom(num = 1):
|
75 | 75 | setNumber = - Math.random() * num + Math.random() * num
|
76 | 76 | return setNumber
|
77 | 77 |
|
78 |
| -particularGruop = THREE.Object3D.new(); |
79 |
| -modularGruop = THREE.Object3D.new(); |
| 78 | +particularGroup = THREE.Object3D.new(); |
| 79 | +modularGroup = THREE.Object3D.new(); |
80 | 80 |
|
81 | 81 | perms = {"flatShading":True, "color":"#111111", "transparent":False, "opacity":1, "wireframe":False}
|
82 | 82 | perms = Object.fromEntries(to_js(perms))
|
83 | 83 |
|
84 | 84 | particle_perms = {"color":"#FFFFFF", "side":THREE.DoubleSide}
|
85 | 85 | particle_perms = Object.fromEntries(to_js(particle_perms))
|
86 | 86 |
|
87 |
| -def create_cubes(mathRandom, modularGruop): |
| 87 | +def create_cubes(mathRandom, modularGroup): |
88 | 88 | i = 0
|
89 | 89 | while i < 30:
|
90 | 90 | geometry = THREE.IcosahedronGeometry.new();
|
|
102 | 102 | cube.rotation.y = mathRandom(180 * Math.PI / 180);
|
103 | 103 | cube.rotation.z = mathRandom(180 * Math.PI / 180);
|
104 | 104 | cube.position.set(cube.positionX, cube.positionY, cube.positionZ);
|
105 |
| - modularGruop.add(cube); |
| 105 | + modularGroup.add(cube); |
106 | 106 | i += 1
|
107 | 107 |
|
108 |
| -create_cubes(mathRandom, modularGruop) |
| 108 | +create_cubes(mathRandom, modularGroup) |
109 | 109 |
|
110 | 110 |
|
111 |
| -def generateParticle(mathRandom, particularGruop, num, amp = 2): |
| 111 | +def generateParticle(mathRandom, particularGroup, num, amp = 2): |
112 | 112 | gmaterial = THREE.MeshPhysicalMaterial.new(particle_perms);
|
113 | 113 | gparticular = THREE.CircleGeometry.new(0.2,5);
|
114 | 114 | i = 0
|
|
119 | 119 | particular.rotation.set(mathRandom(),mathRandom(),mathRandom());
|
120 | 120 | particular.scale.set(pscale,pscale,pscale);
|
121 | 121 | particular.speedValue = mathRandom(1);
|
122 |
| - particularGruop.add(particular); |
| 122 | + particularGroup.add(particular); |
123 | 123 | i += 1
|
124 | 124 |
|
125 |
| -generateParticle(mathRandom, particularGruop, 200, 2) |
| 125 | +generateParticle(mathRandom, particularGroup, 200, 2) |
126 | 126 |
|
127 |
| -sceneGruop.add(particularGruop); |
128 |
| -scene.add(modularGruop); |
129 |
| -scene.add(sceneGruop); |
| 127 | +sceneGroup.add(particularGroup); |
| 128 | +scene.add(modularGroup); |
| 129 | +scene.add(sceneGroup); |
130 | 130 |
|
131 | 131 | camera.position.set(0, 0, cameraRange);
|
132 | 132 | cameraValue = False;
|
|
143 | 143 | lightBack = THREE.PointLight.new(0x0FFFFF, 1);
|
144 | 144 | lightBack.position.set(0, -3, -1);
|
145 | 145 |
|
146 |
| -scene.add(sceneGruop); |
| 146 | +scene.add(sceneGroup); |
147 | 147 | scene.add(light);
|
148 | 148 | scene.add(lightBack);
|
149 | 149 |
|
|
164 | 164 | while True:
|
165 | 165 | time = performance.now() * 0.0003;
|
166 | 166 | i = 0
|
167 |
| - while i < particularGruop.children.length: |
168 |
| - newObject = particularGruop.children[i]; |
| 167 | + while i < particularGroup.children.length: |
| 168 | + newObject = particularGroup.children[i]; |
169 | 169 | newObject.rotation.x += newObject.speedValue/10;
|
170 | 170 | newObject.rotation.y += newObject.speedValue/10;
|
171 | 171 | newObject.rotation.z += newObject.speedValue/10;
|
172 | 172 | i += 1
|
173 | 173 |
|
174 | 174 | i = 0
|
175 |
| - while i < modularGruop.children.length: |
176 |
| - newCubes = modularGruop.children[i]; |
| 175 | + while i < modularGroup.children.length: |
| 176 | + newCubes = modularGroup.children[i]; |
177 | 177 | newCubes.rotation.x += 0.008;
|
178 | 178 | newCubes.rotation.y += 0.005;
|
179 | 179 | newCubes.rotation.z += 0.003;
|
|
183 | 183 | newCubes.position.z = Math.sin(time * newCubes.positionY) * newCubes.positionX;
|
184 | 184 | i += 1
|
185 | 185 |
|
186 |
| - particularGruop.rotation.y += 0.005; |
| 186 | + particularGroup.rotation.y += 0.005; |
187 | 187 |
|
188 |
| - modularGruop.rotation.y -= ((mouse.x * 4) + modularGruop.rotation.y) * uSpeed; |
189 |
| - modularGruop.rotation.x -= ((-mouse.y * 4) + modularGruop.rotation.x) * uSpeed; |
| 188 | + modularGroup.rotation.y -= ((mouse.x * 4) + modularGroup.rotation.y) * uSpeed; |
| 189 | + modularGroup.rotation.x -= ((-mouse.y * 4) + modularGroup.rotation.x) * uSpeed; |
190 | 190 |
|
191 | 191 | renderer.render( scene, camera )
|
192 | 192 | await asyncio.sleep(0.02)
|
|
0 commit comments