[render] added animates
This commit is contained in:
31
src/client/haxe/ru/m/animate/OnceAnimate.hx
Normal file
31
src/client/haxe/ru/m/animate/OnceAnimate.hx
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user