Just a quick post to show off one of the new effects that was in my recent FlashBelt session on particles.
I'm really pleased how this one came out, it's a combination of a little spark particle and a smoke effect, although the smoke looks a little more like retinal burn. Which is fine by me 🙂
It looks like there's a kind of motion blur as the particles fly out, but all I'm doing is actually rotating the lozenge shaped spark particle to match the direction the particle is moving in. The way we calculate the angle of the direction of movement uses pythagorus' theorum - it's the same way that we calculate the angle of a right-angled triangle.
clip.rotation = Math.atan2(velocityY, velocityX);
Except of course that this will return the value in radians and we need degrees. And we do that by multiplying by 180/PI:
clip.rotation = Math.atan2(velocityY, velocityX) * 180 / Math.PI;
Source is in my earlier FlashBelt post.