From de6073356ca47134a054654289ad7cb21e8df52f Mon Sep 17 00:00:00 2001 From: jkpete <1031139173@qq.com> Date: Fri, 26 Jul 2024 16:19:38 +0800 Subject: [PATCH] add kill on end --- Example/Tween/EGTween.tscn | 2 +- Example/Tween/Script/TweenTest.cs | 2 +- addons/EGFramework/Module/NodeExtension/EGTweenExtension.cs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Example/Tween/EGTween.tscn b/Example/Tween/EGTween.tscn index abdd0d3..8a91732 100644 --- a/Example/Tween/EGTween.tscn +++ b/Example/Tween/EGTween.tscn @@ -27,4 +27,4 @@ position = Vector2(146, 80) [node name="Polygon2D" type="Polygon2D" parent="."] position = Vector2(146, 97) -polygon = PackedVector2Array(0, 0, 100, 0, 213.683, 76.1096, 454, 237, 0, 100, 0, 0) +polygon = PackedVector2Array(0, 0, 100, 0, 327, 56, 454, 237, 0, 100, 0, 0) diff --git a/Example/Tween/Script/TweenTest.cs b/Example/Tween/Script/TweenTest.cs index b1400d5..c835c34 100644 --- a/Example/Tween/Script/TweenTest.cs +++ b/Example/Tween/Script/TweenTest.cs @@ -33,7 +33,7 @@ namespace EGFramework.Examples.TweenAnime{ // tween3.TweenProperty(Target,"size",new Vector2(40,100),0.5f); // tween3.TweenProperty(Target,"size",new Vector2(40,40),0.5f); // tween3.SetLoops(); - Target2D.TweenRotationByAngle(360f,1.0f); + Target2D.TweenRotationByAngle(360f,1.0f).KillOnEnd(); } public void TweenOver(){ diff --git a/addons/EGFramework/Module/NodeExtension/EGTweenExtension.cs b/addons/EGFramework/Module/NodeExtension/EGTweenExtension.cs index 592d64e..183f0c9 100644 --- a/addons/EGFramework/Module/NodeExtension/EGTweenExtension.cs +++ b/addons/EGFramework/Module/NodeExtension/EGTweenExtension.cs @@ -4,6 +4,12 @@ using System; namespace EGFramework.EGTween{ public static class EGTweenExtension { + #region Function + public static Tween KillOnEnd(this Tween self){ + self.TweenCallback(Callable.From(self.Kill)); + return self; + } + #endregion #region Position public static Tween TweenPosition(this Control self,Vector2 position,float delay){ Tween tween = self.CreateTween();