xonecas.io
167
Ct

creativejs-threejs-part1 / commit 61612c5

added side movement based on the mouse

sean2011-08-18 61612c5effc09aa17861d8229dbd6b4826f7746b parent 3f486cd

1 file changed

script.js+2−0
@@ -3,6 +3,7 @@ var camera,
33 renderer,
44 mouseX = 0,
55 mouseY = 0,
6+ middle = window.innerWidth / 2,
67 particles = [];
78
89 init();
@@ -96,6 +97,7 @@ function updateParticles () {
9697
9798 if (particle.position.z < -1000) {
9899 particle.position.z += 2000;
100+ particle.position.x = (mouseX - middle) + Math.random() * (i * 10);
99101 }
100102 }
101103 }