Hi @lubos,
Trying to figure out how to get Tweens to work.
When using below code the cube is resized, but there is no 5 sec tween. The cube is 0.1 scale right away at start.
package arm;
class Cube extends armory.Trait {
public function new() {
super();
notifyOnInit(function() {
iron.system.Tween.to(object.transform.scale, 5.0, object.transform.scale = new iron.math.Vec4(0.1, 0.1, 0.1, 1.0), null, 0.0, iron.system.Tween.LINEAR);
});
}
}
When using below code I can see that both tweenScale() and onTweenScaleCompleted() after 1 and 1+5 sec, but nothing happens to the scale of the cube.
package arm;
class Cube extends armory.Trait {
public function new() {
super();
notifyOnInit(function() {
iron.system.Tween.timer(1.0, tweenScale);
});
}
public function tweenScale(){
trace("tweening scale");
iron.system.Tween.to(object.transform.scale, 5.0, object.transform.scale = new iron.math.Vec4(0.1, 0.1, 0.1, 1.0), onTweenScaleComplete, 0.0, iron.system.Tween.LINEAR);
}
public function onTweenScaleComplete(){
trace("tweening completed");
}
}
Can you give me some simple example of how I should use Tween to get it to animate over time?
Thanks!
Kind Regards,
Martin