Simple Mouse-tracking: Making a Circle follow the mouse
Download the file for this animation
To create this animation, type the following text into a new Flash document Actionscript panel:
// Create a ball clip
this.createEmptyMovieClip("ball", 0);
ball.lineStyle(50, 0x0, 100);
ball.moveTo(0, 0);
ball.lineTo(0, 1);
// Animate ball to follow the mouse
ball.onEnterFrame = function( ) {
this._x -= (ball._x - _xmouse) / 4;
this._y -= (ball._y - _ymouse) / 4;
};
Save your file and test it. Modify some of the other parameters in the script to see how they affect the appearance and interactivity of the animation.
More Examples
Tarsier Eye Movement
Download the sample file
3D Tarsier Animation
Download the sample file
More Fun Examples
Gravity (refresh the page if you don't see balls dropping)
Download the file for this animation
Throw a Ball (click, drag, and release the black circle to make it bounce around)
Download the file for this animation
Jeff Sale
E-mail:
jeff.sale (at) gcccd.edu
Phone:
619-660-4000
Fax:
619-660-4399
Graphic Design , Cuyamaca College
You may also reach me at jsale37 (at) gmail.com