Flash CS4: How To Make A 3D Particle Field

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,639
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 18, 2010

This is the script that is used in the tutorial:

var container:MovieClip = new MovieClip();
addChild(container);

root.transform.perspectiveProjection.fieldOfView = 120;

addEventListener(Event.ENTER_FRAME, addStar);

function addStar(e:Event):void
{
var mc:Star = new Star();
mc.x = stage.stageWidth / 2;
mc.y = stage.stageHeight / 2;
mc.z = 0;
mc.xVel = Math.random() * 4 - 2
mc.yVel = Math.random() * 4 - 2
mc.zVel = Math.random() * 4 - 2
mc.count = 0;
container.addChild(mc);
mc.addEventListener(Event.ENTER_FRAME, animate);
}

function animate(e:Event):void
{
e.currentTarget.x += e.currentTarget.xVel;
e.currentTarget.y += e.currentTarget.yVel;
e.currentTarget.z += e.currentTarget.zVel;
e.currentTarget.count++;
if (e.currentTarget.count = 100)
{
e.currentTarget.removeEventListener(Event.ENTER_FRAME, animate);
container.removeChild(MovieClip(e.currentTarget));
}
}

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (1)

Sign In or Sign Up now to post a comment!
  • Hey, good tutorial mate helped me alot (:

    Do you know how I could make it so the star would randomize its color?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more