Files
haxework/src/main/haxework/animate/FadeAnimate.hx
2015-07-14 12:01:51 +03:00

30 lines
669 B
Haxe
Executable File

package haxework.animate;
import haxework.animate.IAnimate;
import flash.display.Sprite;
import haxework.gui.IView;
import haxework.animate.Animate;
class FadeAnimate extends Animate {
private var view:IView;
public function new(view:IView, ?duration = 500) {
super(duration);
this.view = view;
}
override public function start(callback:IAnimate -> Void, ?custom:Bool = false):Void {
view.content.alpha = 1.0;
super.start(callback, custom);
}
override private function update(time:Float):Void {
super.update(time);
view.content.alpha = 1 - (progress * 1.0);
if (progress >= 1) {
view.content.alpha = 0.0;
}
}
}