MovieClip.prototype.ease = function(dx, dy, s, f, da, as, xs, ys, ss) {
// dx = destination x, dy = destination y, s = speed
// f = will alpha effect be applied, da = destination/end alpha, as = alpha speed
// xs = x scale, ys = y scale, ss = scale speed
this.onEnterFrame = function() {
this._x += (dx-this._x)/s;
this._y += (dy-this._y)/s;
this._xscale += (xs-this._xscale)/ss;
this._yscale += (ys-this._yscale)/ss;
if ((this._x == dx and this._y == dy) and (this._xscale == xs and this._yscale == ys) and (f == false or f == null)) {
delete this.onEnterFrame;
}
if (f == true) {
if (as == null) {
as = s;
}
if (da>=this._alpha) {
this._alpha += (da-this._alpha)/as;
} else if (da<=this._alpha) {
this._alpha -= (this._alpha-da)/as;
}
if (this._x == dx and this._y == dy and this._alpha == da) {
delete this.onEnterFrame;
}
}
};
};
|