xonecas.io
167
Ct

creativejs-threejs-part1 / commit 76b7a85

changed the color generation, as sugested by Seb

sean2011-08-19 76b7a85991c9b71e6d6e0b253a11282b9c8b0a01 parent 938c4fc

1 file changed

script.js+2−14
@@ -38,27 +38,15 @@ function update() {
3838 renderer.render(scene, camera);
3939 }
4040
41-function randomColor () {
42- var hex = "0123456789abcdef",
43- color = "0x",
44- key;
45-
46- while (color.length !== 8) {
47- key = Math.floor(Math.random() * hex.length);
48- color += hex[key];
49- }
50-
51- return color;
52-}
53-
5441 function makeParticles () {
5542 var particle, material;
5643
5744 for (var zpos = 1000; zpos > -1000; zpos -= 20) {
5845 material = new THREE.ParticleCanvasMaterial({
59- color: randomColor(),
6046 program: particleRender
6147 });
48+ /* as sugested by Seb */
49+ material.color.setHSV(Math.random(), 1, 0.5);
6250
6351 particle = new THREE.Particle(material);