Question

So ive been looking and changed code on this Particle system for a while now

FIDDLE

I've tried to play around with the calculation for the particle movement with:

'left' : canvas_width * Math.floor(Math.random() * 101) / 100,
'top' : canvas_height * Math.floor(Math.random() * 101) / 100, 

But so far only been able to get the circles to move up and down.

What im looking to do is to have the circles (will be using an cloud image in the CSS) move in upgoing-to the right movement, simulating smoke coming out of a chimney.

Any suggestions?

Was it helpful?

Solution

I believe that's just the starting position, you want to change the velocity it sounds like. It current goes randomly up and down and left and right. If you only want up and right, try something more like:

'x-velocity' : getRandomInt(0, max_velocity*100) / 100, 
'y-velocity' : getRandomInt(-max_velocity*100, 0) / 100 }

So now x velocity will only ever be positive (right) and y velocity will only ever be negative (up).

http://jsfiddle.net/BMwnf/1/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top