package ru.m.animate; @:provide class AnimateManager { public var playing(default, default):Bool; private var timer:Timer; private var animations:Array; 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); } } }