DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Actionscript Easer
// example usage: this.ease('x', 100, 4);
// lower speed value = faster
MovieClip.prototype.ease = function(prop, target, speed) {
delta = this['_' + prop] - target;
if (delta != 0) {
this['_' + prop] = this['_' + prop] - (delta / speed);
delta = this['_' + prop] - target;
if (delta < .25 and delta > -.25) {
this['_' + prop] = target;
delta = 0;
}
}
};





