|
58 | 58 | object.scale.x = Math.random() * 2 + 1; |
59 | 59 | object.scale.y = Math.random() * 2 + 1; |
60 | 60 | object.scale.z = Math.random() * 2 + 1; |
61 | | - object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180; |
62 | | - object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180; |
63 | | - object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180; |
| 61 | + object.rotation.x = Math.random() * 2 * Math.PI; |
| 62 | + object.rotation.y = Math.random() * 2 * Math.PI; |
| 63 | + object.rotation.z = Math.random() * 2 * Math.PI; |
64 | 64 | scene.add( object ); |
65 | 65 |
|
66 | 66 | } |
|
114 | 114 | .easing( TWEEN.Easing.Elastic.Out).start(); |
115 | 115 |
|
116 | 116 | new TWEEN.Tween( intersects[ 0 ].object.rotation ).to( { |
117 | | - x: ( Math.random() * 360 ) * Math.PI / 180, |
118 | | - y: ( Math.random() * 360 ) * Math.PI / 180, |
119 | | - z: ( Math.random() * 360 ) * Math.PI / 180 }, 2000 ) |
| 117 | + x: Math.random() * 2 * Math.PI, |
| 118 | + y: Math.random() * 2 * Math.PI, |
| 119 | + z: Math.random() * 2 * Math.PI }, 2000 ) |
120 | 120 | .easing( TWEEN.Easing.Elastic.Out).start(); |
121 | 121 |
|
122 | 122 | } |
|
149 | 149 |
|
150 | 150 | TWEEN.update(); |
151 | 151 |
|
152 | | - theta += 0.2; |
| 152 | + theta += 0.1; |
153 | 153 |
|
154 | | - camera.position.x = radius * Math.sin( theta * Math.PI / 360 ); |
155 | | - camera.position.y = radius * Math.sin( theta * Math.PI / 360 ); |
156 | | - camera.position.z = radius * Math.cos( theta * Math.PI / 360 ); |
| 154 | + camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) ); |
| 155 | + camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) ); |
| 156 | + camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) ); |
157 | 157 | camera.lookAt( scene.position ); |
158 | 158 |
|
159 | 159 | renderer.render( scene, camera ); |
|
0 commit comments