/**
* Class EaseIn :: EaseIn.as :: by Andrea Giammarchi
* This simple class generates all combinations from a number
* to another to emulate an easein tween movement.
* __________________________________________________
* EXAMPLE:
* clip.movements = EaseIn.get( clip._x, ( clip._x + 150 ) );
* clip.moveto = 0;
* clip.onEnterFrame = function() {
* if( this.moveto == this .movements.length ) {
* delete this.onEnterFrame;
* }
* else {
* this._x = this .movements[ this.moveto++ ];
* }
* }
* --------------------------------------------------
* @type ActionScript 2.0 class file
* @version 0.1 tested
* @author Andrea Giammarchi
* @date 15/02/2005
* @lastMod 15/02/2005 09:12
* @site http://www.3site.it/
*/
class EaseIn {
/**
* public static method
* Generates combinations from start and end numbers
* EaseIn.get( start:Number, end:Number, factor:Number ):Array
* @param Number start position
* @param Number end position
* @param Number factor movement , high is smooter
* low is faster ( default: 5 )
* @return Array array with all combinations
*/
public static function get(start:Number, end:Number, factor:Number):Array {
var ar:Array = new Array();
if (start != undefined && end != undefined) {
start = Math.round(start);
end = Math.round(end);
if (end != start) {
var mop:String;
if (end>start) {
mop = 'ceil';
} else {
mop = 'floor';
}
if (factor == undefined) {
factor = 5;
}
do {
ar.push(start);
start += (end-start)/factor;
start = Math[mop](start);
} while (Math[mop](start+((end-start)/factor)) != start);
}
ar.push(end);
}
return ar;
}
}