https://github.com/akeit0/raytween
Lightning-fast and Zero Allocation Tween Library for Unity.
https://github.com/akeit0/raytween
Last synced: 2 days ago
JSON representation
Lightning-fast and Zero Allocation Tween Library for Unity.
- Host: GitHub
- URL: https://github.com/akeit0/raytween
- Owner: Akeit0
- License: other
- Created: 2024-01-26T08:24:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-01T02:12:50.000Z (over 1 year ago)
- Last Synced: 2024-02-01T12:25:59.340Z (over 1 year ago)
- Language: C#
- Size: 1.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Special Thanks
This library is based on the following libraries created by [AnnulusGames](https://github.com/AnnulusGames).### TweenSystem
**[LitMotion](https://github.com/AnnulusGames/LitMotion)**
### Path tween
**[MagicTween](https://github.com/AnnulusGames/MagicTween)**# Performance
Comparing with [LitMotion](https://github.com/AnnulusGames/LitMotion), start up performance is 1.1 times slower, and the update performance is same.
Exceptionally, string tween is faster than LitMotion.
## How to install### Package Manager
1. Open the Package Manager by going to Window > Package Manager.
2. Click on the "+" button and select "Add package from git URL".
3. Enter the following URL:```
https://github.com/Akeit0/RayTween.git?path=/RayTween/Packages/RayTween
```
### manifest.json
Open `Packages/manifest.json` and add the following in the `dependencies` block:```json
"com.akeit0.com.akeit0.ray-tween": "https://github.com/Akeit0/RayTween.git?path=/RayTween/Packages/RayTween"
```
```cs
void TMPCharMotionExample()
{
// Get the number of characters from TMP_Text.textInfo.characterCount
for (int i = 0; i < text.textInfo.characterCount; i++)
{
RTween.Create(Color.white, Color.red, 1f).BindToTMPCharColor(text, i)
.SetDelay(i * 0.1f)
.SetEase(Ease.OutQuad);RTween.Punch.Create(Vector3.zero, Vector3.up * 15f, 1f).BindToTMPCharPosition(text, i)
.SetDelay(i * 0.1f)
.SetEase(Ease.OutQuad);
}
}
```
```cs
async UniTaskVoid Circle(int count)
{
using PreservedTween p = RTween.CreatePath3D(3f).BindToPosition(transform).WithPath(
Path.AsSpan()).SetOptions(new PathTweenOptions(PathType.CatmullRom, true)).SetEase(Ease.OutSine)
.SetLoops(3, LoopType.Flip).Preserve();for (int i = 0; i < count; i++)
{
RTween.Create(4f, 0.3f).BindToPositionY(transform).SetEase(Ease.OutSine).SetLoops(2, LoopType.Yoyo)
.Forget();await RTween.Create(4f, 0.3f).BindToPositionX(transform).SetEase(Ease.InSine);
await RTween.Create(8f, 0.3f).BindToPositionX(transform).SetEase(Ease.OutSine);
RTween.Create(-4f, 0.3f).BindToPositionY(transform).SetEase(Ease.OutSine).SetLoops(2, LoopType.Yoyo)
.Forget();await RTween.Create(4f, 0.3f).BindToPositionX(transform).SetEase(Ease.InSine);
await RTween.Create(0f, 0.3f).BindToPositionX(transform).SetEase(Ease.OutSine);
}
}
```# License
MIT Licensehttps://github.com/AnnulusGames/LitMotion/blob/main/LICENSE
https://github.com/AnnulusGames/MagicTween/blob/main/LICENSE