[client] use class provide macro

This commit is contained in:
2019-11-18 18:01:26 +03:00
parent 8c16b5ba90
commit d9d385b0ef
6 changed files with 37 additions and 54 deletions

View File

@@ -0,0 +1,34 @@
package ru.m.animate;
@:provide 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);
}
}
}