forked from LeenkxTeam/Leenkx_Examples
34 lines
717 B
Haxe
34 lines
717 B
Haxe
package lnx;
|
|
|
|
import iron.system.Tween;
|
|
#if lnx_debug
|
|
import leenkx.trait.internal.DebugDraw;
|
|
#end
|
|
|
|
class TweenTest extends iron.Trait {
|
|
|
|
@prop var ease : Int = 0;
|
|
|
|
public function new() {
|
|
super();
|
|
notifyOnInit(() -> {
|
|
#if lnx_debug
|
|
//DebugDraw.notifyOnRender( draw -> draw.bounds( object.transform) );
|
|
#end
|
|
doTween(10);
|
|
});
|
|
}
|
|
|
|
function doTween( v : Float ) {
|
|
Tween.to({
|
|
target: object.transform.loc,
|
|
props: { z: v },
|
|
delay: 0.5,
|
|
duration: 2.0,
|
|
ease: ease,
|
|
tick: object.transform.buildMatrix,
|
|
done: () -> doTween(-v)
|
|
});
|
|
}
|
|
}
|