|
First declare, define
and assigned a values to varible.
var t:Number = 0;
var dt:Number = 0.2;
var a:Number = 1.2;
The movie clip "ball_mc" is set to a horizontal position of 10.
ball_mc._x = 10;
A function is created
the is called everytime the movie clip "ball_mc"
enteres a new frame.
ball_mc.onEnterFrame = function(){
Inside this a new function is
created to
calcualtes the acceleration which is exponentialy
related to the time passed. This is then multipled
by the acceleration factor "a", time passed "t"
and the time interval "dt" to give the change in
position.This value is then returned.
ball_mc._x += a*Math.exp(t/2)*t*dt
An interval amount is added
to the total running time.
t += dt;
Each time the mc enters a new
frame an amount is added to the position of the
mc. This amount exponentially increases as time
increases causing the movie clip to exponentially
accelerate off stage.
|