문제

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?

도움이 되었습니까?

해결책

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top