vanilla.namespace("vanilla.animation");vanilla.animation={DefaultFPS:60,linear:function(b,c,a){return(c+(a-c)*b)
},smoothAcceleration:function(b,c,a){return(c+(a-c)*b*b)},acceleration:function(b,c,a){return(c+(a-c)*b*b*b)
},deceleration:function(b,c,a){return(c+(a-c)*Math.pow(b,1/3))}};vanilla.Class("vanilla.animation","Animation");
vanilla.animation.Animation.Extends(vanilla.lang.Thread);vanilla.animation.Animation.Prototype({Animation:function(b,a){this.Thread();
this.startValue=b;this.currentValue=0;this.endValue=a;this.duration=1;this.fps=vanilla.animation.DefaultFPS;
this.startTime=0;this.endTime=0;this.durationInMillis=1;this.method=vanilla.animation.linear;
this.onNextValue=new vanilla.event.CustomEvent(this);this.onBegin=new vanilla.event.CustomEvent(this);
this.onComplete=new vanilla.event.CustomEvent(this)},start:function(){if(!this.isAlive()){this.onBegin.notify(this.startValue);
this.delay=(1000/this.fps);this.startTime=new Date().getTime();this.endTime=this.startTime+this.duration*1000;
this.durationInMillis=this.endTime-this.startTime;this.Super("start",true)
}},run:function(){var a=(new Date().getTime()-this.startTime)/this.durationInMillis;
if(a>1){a=1}var b=this.method(a,this.startValue,this.endValue);this.onNextValue.notify(b);
if(a<1){return Thread.Continue}this.onComplete.notify(b);return Thread.Stop
}});