mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-16 16:13:46 +00:00
Added GTWeen
This commit is contained in:
parent
457998788e
commit
2036e4e748
152 changed files with 5889 additions and 7 deletions
41
GTweensGodot/Godot/Source/Extensions/Sprite2DExtensions.cs
Normal file
41
GTweensGodot/Godot/Source/Extensions/Sprite2DExtensions.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using Godot;
|
||||
using GTweens.Extensions;
|
||||
using GTweens.Tweens;
|
||||
|
||||
namespace GTweensGodot.Extensions;
|
||||
|
||||
public static class Sprite2DExtensions
|
||||
{
|
||||
public static GTween TweenOffset(this Sprite2D target, Vector2 to, float duration)
|
||||
{
|
||||
return GTweenGodotExtensions.Tween(
|
||||
() => target.Offset,
|
||||
current => target.Offset = current,
|
||||
to,
|
||||
duration,
|
||||
GodotObjectExtensions.GetGodotObjectValidationFunction(target)
|
||||
);
|
||||
}
|
||||
|
||||
public static GTween TweenOffsetX(this Sprite2D target, float to, float duration)
|
||||
{
|
||||
return GTweenExtensions.Tween(
|
||||
() => target.Offset.X,
|
||||
current => target.Offset = new Vector2(current, target.Offset.Y),
|
||||
to,
|
||||
duration,
|
||||
GodotObjectExtensions.GetGodotObjectValidationFunction(target)
|
||||
);
|
||||
}
|
||||
|
||||
public static GTween TweenOffsetY(this Sprite2D target, float to, float duration)
|
||||
{
|
||||
return GTweenExtensions.Tween(
|
||||
() => target.Offset.Y,
|
||||
current => target.Offset = new Vector2(target.Offset.X, current),
|
||||
to,
|
||||
duration,
|
||||
GodotObjectExtensions.GetGodotObjectValidationFunction(target)
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue