From 6122db952ae3cd3aeae432404d142fe962b40648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Szila=CC=81gyi?= Date: Thu, 7 May 2026 09:13:08 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=F0=9F=92=AB[Add]=20Extension=20me?= =?UTF-8?q?thod:=20DashAnchoredPosition=20+=20reformat=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Extensions/DashTweenExtensions.cs | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Runtime/Scripts/Extensions/DashTweenExtensions.cs b/Runtime/Scripts/Extensions/DashTweenExtensions.cs index 03fdcce..ae36df0 100644 --- a/Runtime/Scripts/Extensions/DashTweenExtensions.cs +++ b/Runtime/Scripts/Extensions/DashTweenExtensions.cs @@ -9,7 +9,7 @@ namespace Dash { public static class DashTweenExtensions { - static public bool DoNullChecks = false; + public static bool DoNullChecks = false; public static DashTween DashLocalRotate(this Transform p_transform, Vector3 p_rotation, float p_time, bool p_useSpeed = false) { @@ -86,5 +86,34 @@ public static DashTween DashColor(this Graphic p_graphic, Color p_color, float p }).Start(); return tween; } + + public static DashTween DashAnchoredPosition(this RectTransform p_rectTransform, + Vector2 p_finalPosition, + float p_duration, + EaseType p_easeType = EaseType.LINEAR, + float p_delay = 0f) + { + var original = p_rectTransform.anchoredPosition; + var tween = DashTween.To(p_rectTransform, 0f, 1f, p_duration); + + if (p_delay >= 0f) + { + tween.SetDelay(p_delay); + } + + tween.OnInternalUpdate(delta => + { + if (DoNullChecks && p_rectTransform == null) + { + return; + } + + p_rectTransform.anchoredPosition = new Vector2( + DashTween.EaseValue(original.x, p_finalPosition.x, delta, p_easeType), + DashTween.EaseValue(original.y, p_finalPosition.y, delta, p_easeType)); + }); + tween.Start(); + return tween; + } } } \ No newline at end of file From c9c662d081b51a052d80d486fbba869d690bf40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Szila=CC=81gyi?= Date: Wed, 17 Jun 2026 09:39:03 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=F0=9F=92=AB[Add]=20Extension=20me?= =?UTF-8?q?thods:=20DashSizeDelta,=20DashScale,=20DashAnchoredPositionX=20?= =?UTF-8?q?and=20DashAnchoredPositionY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Extensions/DashTweenExtensions.cs | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/Runtime/Scripts/Extensions/DashTweenExtensions.cs b/Runtime/Scripts/Extensions/DashTweenExtensions.cs index ae36df0..e7aa9dc 100644 --- a/Runtime/Scripts/Extensions/DashTweenExtensions.cs +++ b/Runtime/Scripts/Extensions/DashTweenExtensions.cs @@ -114,6 +114,91 @@ public static DashTween DashAnchoredPosition(this RectTransform p_rectTransform, }); tween.Start(); return tween; + } + + public static DashTween DashAnchoredPositionX(this RectTransform p_rectTransform, + float p_finalPosition, + float p_duration, + EaseType p_easeType = EaseType.LINEAR, + float p_delay = 0f) + { + var posY = p_rectTransform.anchoredPosition.y; + return p_rectTransform.TEST_DashAnchoredPosition(new Vector2(p_finalPosition, posY), + p_duration, + p_easeType, + p_delay); + } + + public static DashTween DashAnchoredPositionY(this RectTransform p_rectTransform, + float p_finalPosition, + float p_duration, + EaseType p_easeType = EaseType.LINEAR, + float p_delay = 0f) + { + var posX = p_rectTransform.anchoredPosition.x; + return p_rectTransform.TEST_DashAnchoredPosition(new Vector2(posX, p_finalPosition), + p_duration, + p_easeType, + p_delay); + } + + public static DashTween DashSizeDelta(this RectTransform p_rectTransform, + Vector2 p_finalSize, + float p_duration, + EaseType p_easeType = EaseType.LINEAR, + float p_delay = 0f) + { + var original = p_rectTransform.sizeDelta; + var tween = DashTween.To(p_rectTransform, 0f, 1f, p_duration); + + if (p_delay >= 0f) + { + tween.SetDelay(p_delay); + } + + tween.OnInternalUpdate(delta => + { + if (DoNullChecks && p_rectTransform == null) + { + return; + } + + p_rectTransform.sizeDelta = new Vector2( + DashTween.EaseValue(original.x, p_finalSize.x, delta, p_easeType), + DashTween.EaseValue(original.y, p_finalSize.y, delta, p_easeType)); + }); + tween.Start(); + return tween; + } + + public static DashTween DashScale(this RectTransform p_rectTransform, + Vector2 p_finalScale, + float p_duration, + EaseType p_easeType = EaseType.LINEAR, + float p_delay = 0f) + { + var original = p_rectTransform.localScale; + var tween = DashTween.To(p_rectTransform, 0f, 1f, p_duration); + + if (p_delay >= 0f) + { + tween.SetDelay(p_delay); + } + + tween.OnInternalUpdate(delta => + { + if (DoNullChecks && p_rectTransform == null) + { + return; + } + + p_rectTransform.localScale = new Vector3( + DashTween.EaseValue(original.x, p_finalScale.x, delta, p_easeType), + DashTween.EaseValue(original.y, p_finalScale.y, delta, p_easeType), + 1f); + }); + tween.Start(); + return tween; } } } \ No newline at end of file