- Timestamp:
- 2014-12-15T13:07:02+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nz-flag-design/trunk/render-3d/weather/rain.js
r29475 r29634 3 3 4 4 this.isInit = false; 5 this.MASS = 0.01; 5 6 6 7 this.init = function() { … … 13 14 14 15 // create the particle variables 15 this.particleCount = 1800,16 this.particleCount = 3500, 16 17 this.particles = new THREE.Geometry(), 17 18 this.pMaterial = new THREE.ParticleBasicMaterial({ … … 31 32 // create a particle with random 32 33 // position values, -250 -> 250 33 var pX = Math.random() * window.innerWidth * 2 - window.innerWidth,34 35 pZ = Math.random() * window.innerWidth * 2 - window.innerWidth;36 this.particle = new THREE.Vector3(pX, pY, pZ); 34 var pX = (Math.random() * 3000) - 1500, 35 pY = Math.random() * window.innerHeight * 3 - window.innerHeight, 36 pZ = (Math.random() * 3000) - 1500; 37 this.particle = new THREE.Vector3(pX, pY, pZ); 37 38 38 39 // create a velocity vector 39 40 0, // x41 -Math.random(), // y42 0); // z40 this.particle.velocity = new THREE.Vector3( 41 (windForce.x * this.MASS), // x 42 -Math.random() * 0.01, // y 43 (windForce.z * this.MASS)); // z 43 44 44 45 // add it to the geometry … … 70 71 71 72 // check if we need to reset 72 if(this.particle.y < - 200) {73 this.particle.y = Math.random() * window.innerHeight+10;73 if(this.particle.y < -10) { 74 this.particle.y = (window.innerHeight*2)+(Math.random() * 100); 74 75 this.particle.velocity.y = 0; 76 this.particle.x = (Math.random() * 4000) - 2000; 77 this.particle.z = (Math.random() * 4000) - 2000; 78 75 79 } 76 80 77 81 // update the velocity 78 this.particle.velocity.y -= Math.random() * .1;82 this.particle.velocity.y -= Math.random() * 0.01; 79 83 80 84 // and the position
Note:
See TracChangeset
for help on using the changeset viewer.