|
128 | 128 | color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 ); |
129 | 129 | colors2.setXYZ( i, color.r, color.g, color.b ); |
130 | 130 |
|
131 | | - color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 ); |
| 131 | + color.setRGB( 1, 0.8 - ( positions3.getY( i ) / radius + 1 ) / 2, 0 ); |
132 | 132 | colors3.setXYZ( i, color.r, color.g, color.b ); |
133 | 133 |
|
134 | 134 | } |
|
184 | 184 | mesh2.rotation.z += Math.PI / 500; |
185 | 185 | mesh3.rotation.z += Math.PI / 500; |
186 | 186 |
|
| 187 | + var position = new THREE.Vector3(); |
| 188 | + var color = new THREE.Color(); |
| 189 | + |
| 190 | + var time = performance.now() / 500; |
| 191 | + |
| 192 | + var positions = mesh3.geometry.attributes.position; |
| 193 | + var colors = mesh3.geometry.attributes.color; |
| 194 | + |
| 195 | + for ( var i = 0, l = positions.count; i < l; i ++ ) { |
| 196 | + |
| 197 | + position.fromArray( positions.array, i * 3 ); |
| 198 | + |
| 199 | + color.setRGB( 1, Math.sin( time + position.x ), Math.cos( time * 2.123 + position.x ) ); |
| 200 | + colors.setXYZ( i, color.r, color.g, color.b ); |
| 201 | + |
| 202 | + } |
| 203 | + |
| 204 | + colors.needsUpdate = true; |
| 205 | + |
187 | 206 | // |
188 | 207 |
|
189 | 208 | var time = performance.now() / 2000; |
|
0 commit comments