Hi everyone,

I was wondering if anyone could aid me in understanding how to apply this code to an actual movieclip and have it move.
[AS]Math.linearTween = function (t, b, c, d) {
return c*t/d + b;

Thanks A Lot


Robert Penner’s easing equations can be tricky :slight_smile:

Thanks A Lot Ilyas, I have another question concerning the code form that post.
[AS] MovieClip.prototype.linearTween = function(endx, endy, duration) {
var x = (endx-this._x)/duration, y = (endy-this._y)/duration, t;
this.onEnterFrame = function() {
if (t++ <duration) {
this._x += x;
this._y += y;
} else {
delete this.onEnterFrame;
ball_mc.linearTween(400, 0, 50);[/AS]
In the line:
[AS]if (t++ <duration) {[/AS]
If I remove ++ the tweening continues and doesn’t stop and even if I [AS]trace(t)[/AS] it is outputed as [AS]undefined[/AS] so I was wondering why the significant difference.

Thanks again