[render] added animates

This commit is contained in:
2018-02-01 00:05:14 +03:00
parent f2f860fc9d
commit 6f338584eb
6 changed files with 191 additions and 29 deletions

View File

@@ -0,0 +1,31 @@
package ru.m.animate;
import promhx.Deferred;
import flash.display.BitmapData;
import promhx.Promise;
class OnceAnimate extends Animate {
private var deferred:Deferred<Animate>;
public function new(frames:Array<BitmapData>) {
super(frames);
}
public function play():Promise<Animate> {
deferred = new Deferred();
playing = true;
return deferred.promise();
}
override private function update():Void {
super.update();
if (index == 0) {
playing = false;
if (deferred != null) {
deferred.resolve(this);
}
}
}
}