[client] use class provide macro
This commit is contained in:
@@ -3,46 +3,12 @@ package ru.m.animate;
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.PixelSnapping;
|
||||
import haxe.Timer;
|
||||
|
||||
typedef Frame = {
|
||||
var image:BitmapData;
|
||||
var length:Int;
|
||||
}
|
||||
|
||||
class AnimateManager {
|
||||
public var playing(default, default):Bool;
|
||||
|
||||
private var timer:Timer;
|
||||
private var animations:Array<Animate>;
|
||||
|
||||
public function new() {
|
||||
animations = [];
|
||||
timer = new Timer(30);
|
||||
timer.run = update;
|
||||
}
|
||||
|
||||
public function update():Void {
|
||||
if (playing) {
|
||||
for (animation in animations) {
|
||||
if (animation.playing) {
|
||||
animation.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function add(animate:Animate):Void {
|
||||
animations.push(animate);
|
||||
}
|
||||
|
||||
public function remove(animate:Animate):Void {
|
||||
if (animations.indexOf(animate) > -1) {
|
||||
animations.remove(animate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Animate extends Bitmap {
|
||||
|
||||
public var playing(default, default):Bool;
|
||||
|
||||
Reference in New Issue
Block a user