From 40714ae6ebbe67cbb21f4e1ebc24009dc3fee68c Mon Sep 17 00:00:00 2001 From: Inspiaaa Date: Thu, 5 Sep 2024 15:33:20 +0200 Subject: [PATCH] Update demo code --- demo/IconAnimation.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/demo/IconAnimation.cs b/demo/IconAnimation.cs index 3fb6a77..693ded9 100644 --- a/demo/IconAnimation.cs +++ b/demo/IconAnimation.cs @@ -8,10 +8,10 @@ public partial class IconAnimation : Node2D { public override void _Ready() { - Co.Run(DoAnimation()); + Co.Run(PlayAnimation()); } - private IEnumerator DoAnimation() + private IEnumerator PlayAnimation() { yield return MoveToPosition(new Vector2(0, 0), 2); @@ -34,13 +34,10 @@ private IEnumerator DoAnimation() private CoroutineBase MoveToPosition(Vector2 targetPos, float duration) { - return Co.Tween(() => { - var tween = CreateTween(); - tween - .TweenProperty(this, "position", targetPos, duration) - .SetTrans(Tween.TransitionType.Cubic); - return tween; - }); + return Co.Tween(tween => tween + .TweenProperty(this, "position", targetPos, duration) + .SetTrans(Tween.TransitionType.Cubic) + ); } private IEnumerator FullRotation(float duration)