diff --git a/src/motion/Actuate.hx b/src/motion/Actuate.hx index 79c7587..8294253 100644 --- a/src/motion/Actuate.hx +++ b/src/motion/Actuate.hx @@ -71,7 +71,45 @@ class Actuate { } #end - + + public static var timeScale(get, set):Float; + private static var _timeScale:Float = 1.0; + + private static function get_timeScale():Float + { + return _timeScale; + } + + private static function set_timeScale(value:Float):Float + { + _timeScale = value; + + #if neko + + for (library in methodLibraries) { + + for (actuator in library) { + + actuator.timeScale = value; + + } + + } + + #end + + for (library in targetLibraries) { + + for (actuator in library) { + + actuator.timeScale = value; + + } + + } + + return value; + } private static function getLibrary (target:T, allowCreation:Bool = true):Array { diff --git a/src/motion/actuators/GenericActuator.hx b/src/motion/actuators/GenericActuator.hx index cae064b..cf9ffb0 100644 --- a/src/motion/actuators/GenericActuator.hx +++ b/src/motion/actuators/GenericActuator.hx @@ -8,8 +8,10 @@ import motion.Actuate; class GenericActuator implements IGenericActuator { - - + + public var timeScale(get, set):Float; + private var _timeScale:Float = 1.0; + private var duration:Float; private var id:String; private var properties:Dynamic; @@ -36,7 +38,8 @@ class GenericActuator implements IGenericActuator { public function new (target:T, duration:Float, properties:Dynamic) { - + + _timeScale = Actuate.timeScale; _autoVisible = true; _delay = 0; _reflect = false; @@ -452,6 +455,16 @@ class GenericActuator implements IGenericActuator { } - - + + private function get_timeScale():Float + { + return _timeScale; + } + + private function set_timeScale(value:Float):Float + { + _timeScale = value; + + return value; + } } \ No newline at end of file diff --git a/src/motion/actuators/IGenericActuator.hx b/src/motion/actuators/IGenericActuator.hx index dc93d66..0b46701 100644 --- a/src/motion/actuators/IGenericActuator.hx +++ b/src/motion/actuators/IGenericActuator.hx @@ -110,6 +110,6 @@ interface IGenericActuator { private function pause ():Void; private function resume ():Void; private function stop (properties:Dynamic, complete:Bool, sendEvent:Bool):Void; - - + + var timeScale(get, set):Float; } \ No newline at end of file diff --git a/src/motion/actuators/SimpleActuator.hx b/src/motion/actuators/SimpleActuator.hx index e6ae0f9..7513f58 100644 --- a/src/motion/actuators/SimpleActuator.hx +++ b/src/motion/actuators/SimpleActuator.hx @@ -465,7 +465,7 @@ class SimpleActuator extends GenericActuator { var easing:Float; var i:Int; - var tweenPosition:Float = (currentTime - timeOffset) / duration; + var tweenPosition:Float = (currentTime - timeOffset) * _timeScale / duration; if (tweenPosition > 1) {