gilzoide / unity-tween-jobs

Tween engine for Unity based on the C# Job System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tween Jobs

openupm

(WIP) Tween engine for Unity based on the C# Job System.

Features

  • Supports tweening float, Vector2, Vector3, Vector4, Quaternion, Color and Rect values
  • Highly configurable: easing function, duration, animation speed, deltaTime vs unscaledDeltaTime, repeat vs ping-pong loops
  • Tweeners are serializable C# classes that can be easily embedded in your own components
  • Ready-made tween components with embedded tweeners for ease of integration
  • Tween math runs in parallel jobs using the C# Job System. Jobs are compiled with Burst for maximum performance

Dependencies

How to install

Either:

  • Use the openupm registry and install this package using the openupm-cli:
    openupm add com.gilzoide.tween-jobs
    
  • Install using the Unity Package Manager with the following URL:
    https://github.com/gilzoide/unity-tween-jobs.git#1.0.0-preview4
    
  • Clone this repository or download a snapshot of it directly inside your project's Assets or Packages folder.

Creating your own tweener

// MySpriteColorTween.cs
using System;
using Gilzoide.TweenJobs;
using UnityEngine;

// 1. Create a serializable class that inherits A*Tweener
// Supported tween types: float, Vector2, Vector3, Vector4, Quaternion, Color and Rect
[Serializable]
public class MySpriteColorTweener : AColorTweener
{
    public SpriteRenderer targetSprite;

    // 2. Implement the `Value` property
    public override Color Value
    {
        get => targetSprite.color;
        set => targetSprite.color = value;
    }
}

// 3. (optional) Create a wrapper component for your tweener
public class MySpriteColorTween : ATweenComponent<MySpriteColorTweener>
{
}

// 4. Use your tweener/tween component just like the builtin ones.
// Enjoy 🍾

About

Tween engine for Unity based on the C# Job System

License:The Unlicense


Languages

Language:C# 100.0%