Note that there are some explanatory texts on larger screens.

plurals
  1. POSnowfall Canvas, Change Particle Speed
    primarykey
    data
    text
    <p>I'm trying to change the particle speed of this snowfall script but I can't seem to find the numbers that represent "Falling Speed". Right now the particles are falling too fast, here's the bulk of the script:</p> <pre><code>var SCREEN_WIDTH = window.innerWidth; var SCREEN_HEIGHT = window.innerHeight; var container; var particle; var camera; var scene; var renderer; var mouseX = 0; var mouseY = 0; var windowHalfX = window.innerWidth / 2; var windowHalfY = window.innerHeight / 2; var particles = []; var imgArr = new Array(); function init() { container = document.createElement('div'); document.body.appendChild(container); camera = new THREE.PerspectiveCamera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 ); camera.position.z = 1000; scene = new THREE.Scene(); renderer = new THREE.CanvasRenderer(); renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); for (var i = 0; i &lt; 1000; i++) { var particleImage = new Image(); particleImage.src = imgArr[Math.round(Math.random()*(imgArr.length-1))]; var material = new THREE.ParticleBasicMaterial( { map: new THREE.Texture(particleImage) } ); particle = new Particle3D( material); particle.position.x = Math.random() * 2000 - 1000; particle.position.y = Math.random() * 2000 - 1000; particle.position.z = Math.random() * 2000 - 1000; particle.scale.x = particle.scale.y = 0.8; scene.add( particle ); particles.push(particle); } container.appendChild( renderer.domElement ); setInterval( loop, 1000 / 60 ); } function loop() { for(var i = 0; i&lt;particles.length; i++) { var particle = particles[i]; particle.updatePhysics(); with(particle.position) { if(y&lt;-1000) y+=2000; if(x&gt;1000) x-=2000; else if(x&lt;-1000) x+=2000; if(z&gt;1000) z-=2000; else if(z&lt;-1000) z+=2000; } } renderer.render( scene, camera ); } </code></pre> <p>It's using Three.js as a backbone. Here's the original script to see it in action:</p> <p><a href="http://seb.ly/demos/JSSnow/snow3d.html" rel="nofollow">http://seb.ly/demos/JSSnow/snow3d.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload