-
Notifications
You must be signed in to change notification settings - Fork 8
Simplified Tweens
Valk edited this page Oct 28, 2024
·
4 revisions
Tweening has never been so easy!!! 🦄
new RTween(colorRect)
.SetParallel()
.Animate("scale", Vector2.One * 2, 2).Elastic()
.Animate("color", Colors.Green, 2).Sine().EaseIn()
.Animate("rotation", Mathf.Pi, 2).Elastic().EaseOut();
RTween tween = new RTween(colorRect)
.SetAnimatingProp("color")
.AnimateProp(Colors.Red, 0.5).Sine().EaseIn()
.Parallel().AnimateProp(Colors.Green, 0.5).Sine().EaseOut()
.Parallel().Animate("scale", Vector2.One * 2, 0.5).Sine()
.Callback(() => GD.Print("Finished!"))
.Loop();
tween.Stop();
Tip
Prefer strongly typed names over strings? Instead of typing for example "scale"
do Control.PropertyName.Scale
Tip
Below is an example of how to run delayed code. Tweens are attached to nodes so if the node gets destroyed so will the tween.
GTween.Delay(node, seconds, () => callback);