- 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/snow.js
r29547 r29634 3 3 4 4 this.isInit = false; 5 this.M ass = 0.01;5 this.MASS = 0.005; 6 6 7 7 this.init = function() { … … 14 14 15 15 // create the particle variables 16 this.particleCount = 2000,16 this.particleCount = 3000, 17 17 this.particles = new THREE.Geometry(), 18 18 … … 32 32 33 33 // create a particle with random 34 // position values , -250 -> 25035 var pX = Math.random() * window.innerWidth * 3 - window.innerWidth,36 pY = Math.random() * window.innerHeight * 4- window.innerHeight,37 pZ = Math.random() * window.innerWidth * 3 - window.innerWidth;34 // position values 35 var pX = (Math.random() * 3000) - 1500, 36 pY = Math.random() * window.innerHeight * 3 - window.innerHeight, 37 pZ = (Math.random() * 3000) - 1500; 38 38 this.particle = new THREE.Vector3(pX, pY, pZ); 39 39 40 40 // create a velocity vector 41 41 this.particle.velocity = new THREE.Vector3( 42 0, // x 43 -Math.random(), // y 44 0); // z 45 42 (windForce.x * this.MASS), // x 43 -Math.random() * 0.01, // y 44 (windForce.z * this.MASS)); // z 45 46 //this.particle.velocity.z = arrow.direction.z * this.MASS; 46 47 // add it to the geometry 47 48 this.particles.vertices.push(this.particle); … … 73 74 74 75 // check if we need to reset 75 if(this.particle.y < - 200) {76 this.particle.y = Math.random() * window.innerHeight+10;76 if(this.particle.y < -10) { 77 this.particle.y = (window.innerHeight*2)+(Math.random() * 100); 77 78 this.particle.velocity.y = 0; 79 this.particle.x = (Math.random() * 4000) - 2000; 80 this.particle.z = (Math.random() * 4000) - 2000; 81 78 82 } 79 83 80 84 // update the velocity 81 this.particle.velocity.y -= Math.random() * this.Mass; 82 85 this.particle.velocity.y -= Math.random() * 0.001; 86 //this.particle.velocity.x = (windForce.x * this.MASS); 87 //this.particle.velocity.z = (windForce.z * this.MASS); 88 83 89 // and the position 84 90 this.particle.addVectors(
Note:
See TracChangeset
for help on using the changeset viewer.