Skip to content

Latest commit

 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EaseTween

简体中文

EaseTween is a small data-oriented tween runner for Unity. It updates values through an explicit tick loop without owning your GameObject or MonoBehaviour lifecycle.

EaseTween cover

What EaseTween does

  • Tweens float, int, Vector2, Vector3, Color, Color32, and Quaternion values.
  • Supports waits, update and completion callbacks, looping, and chained tweens.
  • Provides play, pause, resume, stop, reset, progress, and removal controls.
  • Keeps scene-object changes in your code: EaseTween calculates values, while your callback decides where they go.
  • Keeps the warmed-up steady-state Tick path free of measured GC allocations after setup; creation, callback binding, removal, and capacity growth are outside that claim.

Installation

In Unity, open Window → Package Manager, choose Add package from git URL, and enter:

https://github.com/onovich/EaseTween.git?path=/Assets/com.mortise.easetween#main

The package metadata declares Unity 2019.4 or later. The included sample project currently uses Unity 2023.2.22f1; other editor versions have not been covered by automated compatibility tests.

Quick start

using MortiseFrame.EaseTween;
using UnityEngine;

public sealed class MoveSample : MonoBehaviour {
    TweenCore tweenCore;

    void Start() {
        tweenCore = new TweenCore();

        int moveTweenId = tweenCore.Create(
            transform.position,
            transform.position + Vector3.right * 5f,
            1f,
            EasingType.SineInOut
        );

        tweenCore.OnUpdate(moveTweenId, (Vector3 position) => {
            transform.position = position;
        });

        tweenCore.Play(moveTweenId);
    }

    void Update() {
        tweenCore.Tick(Time.deltaTime);
    }

    void OnDestroy() {
        tweenCore?.Dispose();
    }
}

Create multiple tween IDs and connect them with tweenCore.Link(fromId, toId) when one tween should start after another.

Allocation behavior

A focused batch-mode probe in Unity 2023.2.22f1 measured 0 GC.Alloc samples across 10,000 steady-state Tick calls after construction, tween creation, callback binding, and warm-up.

This is not a whole-library zero-allocation guarantee. The same probe recorded allocation samples during other lifecycle operations:

Measured operation Work performed GC.Alloc samples
TweenCore construction 1 construction 33
Dynamic creation and callback binding 2,048 operations 18
Removal 2,304 operations 11

Dictionary and queue growth, delegate binding, and capacity changes can allocate. Treat “GC-free” as a measured property of the warmed-up update path, not every EaseTween operation. See docs/performance.md for the complete scope and interpretation.

Status

The repository contains the core tween runtime and a Unity sample scene. The current package version is 0.0.11.

EaseTween has no automated regression-test suite or documented commercial-project validation. The allocation result above comes from one focused Editor probe, not continuous benchmarking across Unity versions. Verify the library against your target Unity version and workload before production use.

Development

Open the repository as a Unity project to run the included sample. The runtime package lives in Assets/com.mortise.easetween/, and the sample code lives in Assets/com.mortise.easetween.sample/.

License

No open-source license is currently included in this repository.

About

A Unity tween runner with measured GC-free steady-state updates after setup.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages