Examples of 2d Canvas smoke with mouse interaction. -


i'm looking example of smoke effect using html 2d canvas smoke effected user moving mouse though smoke smoke disturbed.

i don't know if still interesting in but, here take @ this so, instead of checking if particle touched edge should provide mouse x,y coordinates:

function init() {     var canvas = document.getelementbyid('mycanvas');     if (canvas.getcontext) {          // set context variable can re-used         context = canvas.getcontext('2d');          // create particles , set initial positions , velocities         for(var i=0; < particlecount; ++i){             var particle = new particle(context);              // set position inside canvas bounds             particle.setposition(generaterandom(0, canvaswidth), generaterandom(0, canvasheight));              // set initial velocity either random , either negative or positive             particle.setvelocity(generaterandom(-maxvelocity, maxvelocity), generaterandom(-maxvelocity, maxvelocity));             particles.push(particle);                     }     }     else {         alert("please use modern browser");     } } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -