Nadim is Simple

December 30, 2008

Math for Simple Particle Generation with ActionScript 3.0

Filed under: Creativity, Tutorial — Tags: , , , , — Nadim Jahangir @ 8:48 pm

I was just passing my time and built a simple but pretty nice particle generator in ActionScript 3.0. I assumed the particles to be small projectiles and motion of which are driven by the following equations,

x = x0 + vxt

y = y0 + vyt – 0.5gt2

where,

x0 = initial position along x-axis

y0 = initial position along y-axis

vx = initial velocity along x-axis

vy = initial velocity along y-axis

g = acceleration due to gravity

In the demo http://nadimjahangir.net/xp/particle.swf the initial position are set to mouse position. And initial velocities are set randomly.

Particle Generation Demo

Particle Generation Demo

This can further be enhanced by adding air friction terms.

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.