GroveGames.Tween
0.0.9
dotnet add package GroveGames.Tween --version 0.0.9
NuGet\Install-Package GroveGames.Tween -Version 0.0.9
<PackageReference Include="GroveGames.Tween" Version="0.0.9" />
<PackageVersion Include="GroveGames.Tween" Version="0.0.9" />
<PackageReference Include="GroveGames.Tween" />
paket add GroveGames.Tween --version 0.0.9
#r "nuget: GroveGames.Tween, 0.0.9"
#:package GroveGames.Tween@0.0.9
#addin nuget:?package=GroveGames.Tween&version=0.0.9
#tool nuget:?package=GroveGames.Tween&version=0.0.9
GroveGames.Tween
GroveGames.Tween is a lightweight and extensible tweening library for Godot, designed to animate values smoothly over time. It provides an easy-to-use API for creating tweens and sequences, with built-in easing functions for smooth transitions.
Features
- Flexible Tweening: Tween any type of value, including
float,Vector3, and more. - Ease Functions: Use predefined easing functions to customize the motion.
- Sequences: Chain tweens and callbacks for complex animations.
- Extensions: Built-in support for animating properties of
Godot Nodes, such as position, rotation, and scale. - Customizable Behavior: Easily add callbacks for updates and completions.
Installation
Using NuGet
To add GroveGames.Tween.Godot to your project, install the NuGet package:
dotnet add package GroveGames.Tween.Godot
Alternatively, use the Package Manager Console in Visual Studio:
Install-Package GroveGames.Tween.Godot
Once installed, ensure that your project references the GroveGames.Tween namespace and its sub-namespaces.
Usage
Basic Tween Example
using Godot;
using GroveGames.Tween.Core;
public class Example : Node3D
{
private TweenerContext _tweenContext;
public override void _Ready()
{
_tweenContext = new TweenerContext();
// Move this Node3D to a new position over 2 seconds
this.MoveTo(new Vector3(5, 5, 0), 2f, _tweenContext)
.SetOnComplete(() => GD.Print("Move completed!"));
}
public override void _Process(float delta)
{
// Update tweens
_tweenContext.Update(delta);
}
}
Using Sequences
using Godot;
using GroveGames.Tween.Core;
public class SequenceExample : Node3D
{
private TweenerContext _tweenContext;
public override void _Ready()
{
_tweenContext = new TweenerContext();
var sequence = _tweenContext.CreateSequence();
sequence
.Then(this.MoveTo(new Vector3(5, 5, 0), 2f, _tweenContext, false))
.Wait(1f)
.Callback(() => GD.Print("Reached target!"))
.Play();
}
public override void _Process(float delta)
{
_tweenContext.Update(delta);
}
}
Extension Methods
The library includes handy extension methods for Node3D, Node2D, Transform3D, Transform2D, etc. objects. Examples include:
MoveTo(Vector3 target, float duration, TweenerContext context)RotateTo(Vector3 targetDegrees, float duration, TweenerContext context)ScaleTo(Vector3 target, float duration, TweenerContext context)
Each method has variations to animate specific axes (e.g., MoveXTo, RotateYTo).
API Reference
Tween Interfaces
ITween
void SetEase(EaseType easeType)void SetOnComplete(Action onComplete)void Stop(bool complete)void Update(float deltaTime)void Pause()void Play()bool IsRunningbool IsPlayingfloat Duration
ITween<T> (Generic)
void SetOnUpdate(Action<T> onUpdate)
ISequence
ISequence Then(ITween tween)ISequence With(ITween tween)ISequence Wait(float interval)ISequence Callback(Action callback)void Reset()
Customization
Easing Functions
Customize your tweening with easing functions defined in the EaseType enum. Example:
tween.SetEase(EaseType.QuadInOut);
Custom Lerp Functions
Provide your own interpolation function for advanced use cases:
var tween = context.CreateTween(
() => currentValue,
() => targetValue,
duration,
(start, end, t) => start + (end - start) * t
);
Contributing
Contributions are welcome! Feel free to submit issues or pull requests to improve this library.
License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- GroveGames.ObjectPool (>= 0.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GroveGames.Tween:
| Package | Downloads |
|---|---|
|
GroveGames.Tween.Godot
Lightweight Tween library for Godot C# |
GitHub repositories
This package is not used by any popular GitHub repositories.