{"id":16209913,"url":"https://github.com/annulusgames/litmotion","last_synced_at":"2025-05-14T19:02:50.926Z","repository":{"id":214015140,"uuid":"735483509","full_name":"annulusgames/LitMotion","owner":"annulusgames","description":"Lightning-fast and Zero Allocation Tween Library for Unity.","archived":false,"fork":false,"pushed_at":"2025-03-02T02:43:16.000Z","size":7245,"stargazers_count":1235,"open_issues_count":17,"forks_count":83,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-13T13:57:58.646Z","etag":null,"topics":["animation","dots","easing","tween","tweening","unity","zero-allocation"],"latest_commit_sha":null,"homepage":"https://annulusgames.github.io/LitMotion/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/annulusgames.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-25T05:15:23.000Z","updated_at":"2025-04-13T08:53:22.000Z","dependencies_parsed_at":"2024-01-27T06:33:42.401Z","dependency_job_id":"5cdd1adf-da76-46e6-94db-3c0c256f51b7","html_url":"https://github.com/annulusgames/LitMotion","commit_stats":{"total_commits":541,"total_committers":9,"mean_commits":"60.111111111111114","dds":0.03512014787430684,"last_synced_commit":"f7df4966aa30482fb739148aba2bc7bc672dfaf6"},"previous_names":["annulusgames/litmotion","yn01dev/litmotion","yn01-dev/litmotion","nuskey8/litmotion"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FLitMotion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FLitMotion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FLitMotion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FLitMotion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/annulusgames","download_url":"https://codeload.github.com/annulusgames/LitMotion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724583,"owners_count":21151559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","dots","easing","tween","tweening","unity","zero-allocation"],"created_at":"2024-10-10T10:34:04.545Z","updated_at":"2025-04-13T13:58:13.896Z","avatar_url":"https://github.com/annulusgames.png","language":"C#","readme":"# LitMotion\n\nLightning-fast and Zero Allocation Tween Library for Unity.\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/header.png\" width=\"800\"\u003e\n\n[![license](https://img.shields.io/badge/LICENSE-MIT-green.svg)](LICENSE)\n\n[日本語版READMEはこちら](README_JA.md)\n\n## Overview\n\nLitMotion is a high-performance tween library for Unity. LitMotion includes a rich set of features for animating components such as Transform, Material, TextMeshPro, and any field/property, making it easy to create animations.\n\nLitMotion is my second tween library I created after [Magic Tween](https://github.com/annulusgames/MagicTween). LitMotion was designed based on experience implementing Magic Tween to achieve rich functionality and extremely high performance. In all situations such as creating and updating tweens, it exhibits overwhelming performance that is 2 to 20 times faster than other tween libraries. Of course, there is no allocation at all when creating a tween.\n\n![img](./docs/images/img-v2-available.png)\n\nAdditionally, v2 introduces Sequence for combining multiple motions and the LitMotion.Animation package, which allows you to create tween animations directly from the Inspector. With these additions, LitMotion is now as powerful, if not more, than DOTween Pro or PrimeTween in terms of features.\n\n## Documentation\n\nThe full version of documentation can be found [here](https://annulusgames.github.io/LitMotion/).\n\n## Features\n\n* Animate anything in one line of code.\n* Achieves zero allocations with the struct-based design\n* Extremely high-performance implementation optimized using DOTS (Data-Oriented Technology Stack)\n* Works in both runtime and editor\n* Supports complex settings like easing and looping\n* Waits for completion using callbacks/coroutines\n* Zero allocation text animationSupports TextMesh Pro / UI Toolkit\n* Special motions like Punch, Shake, etc.\n* Conversion to Observable using [UniRx](https://github.com/neuecc/UniRx) / [R3](https://github.com/Cysharp/R3)\n* async/await support using [UniTask](https://github.com/Cysharp/UniTask)\n* Type extension with `IMotionOptions` and `IMotionAdapter`\n* Integration with the Inspector via `SerializableMotionSettings\u003cT, TOptions\u003e`\n* Debugging API and LitMotion Debugger window\n* Combine animations using `LSequence`\n* Create complex animations directly from the Inspector with the [LitMotion.Animation](articles/en/litmotion-animation-overview.md) package\n\n## Setup\n\n### Requirements\n\n* Unity 2021.3 or later\n* Burst 1.6.0 or later\n* Collection 1.5.1 or later\n* Mathematics 1.0.0 or later\n\n### Installation\n\n1. Open Package Manager from Window \u003e Package Manager.\n2. Click the \"+\" button \u003e Add package from git URL.\n3. Enter the following URL:\n\n```\nhttps://github.com/annulusgames/LitMotion.git?path=src/LitMotion/Assets/LitMotion\n```\n\nAlternatively, open Packages/manifest.json and add the following to the dependencies block:\n\n```json\n{\n    \"dependencies\": {\n        \"com.annulusgames.lit-motion\": \"https://github.com/annulusgames/LitMotion.git?path=src/LitMotion/Assets/LitMotion\"\n    }\n}\n```\n\n## Getting Started\n\nUsing LitMotion allows easy animation of values such as Transform and Material. To create motion, use `LMotion.Create()`.\n\nHere's a sample code. Refer to the documentation for more details.\n\n```cs\nusing System;\nusing System.Threading;\nusing UnityEngine;\nusing R3; // R3\nusing Cysharp.Threading.Tasks; // UniTask\nusing LitMotion;\nusing LitMotion.Extensions;\n\npublic class Example : MonoBehaviour\n{\n    [SerializeField] Transform target1;\n    [SerializeField] Transform target2;\n    [SerializeField] TMP_Text tmpText;\n\n    void Start()\n    {\n        LMotion.Create(Vector3.zero, Vector3.one, 2f) // Animate values from (0f, 0f, 0f) to (1f, 1f, 1f) over 2 seconds\n            .BindToPosition(target1); // Bind to target1.position\n\n        LMotion.Create(0f, 10f, 2f) // Animate from 0f to 10f over 2 seconds\n            .WithEase(Ease.OutQuad) // Specify easing function\n            .WithLoops(2, LoopType.Yoyo) // Specify loop count and type\n            .WithDelay(0.2f) // Set delay\n            .BindToUnityLogger(); // Bind to Debug.unityLogger and display values in Console on update\n\n        var value = 0f;\n        LMotion.Create(0f, 10f, 2f) // Animate from 0f to 10f over 2 seconds\n            .WithScheduler(MotionScheduler.FixedUpdate) // Specify execution timing with Scheduler\n            .WithOnComplete(() =\u003e Debug.Log(\"Complete!\")) // Set a callback\n            .WithCancelOnError() // Cancel motion if an exception occurs within Bind\n            .Bind(x =\u003e value = x) // Bind to any variable, field, or property\n            .AddTo(gameObject); // Cancel motion when the GameObject is destroyed\n        \n        LMotion.String.Create128Bytes(\"\", \"\u003ccolor=red\u003eZero\u003c/color\u003e Allocation \u003ci\u003eText\u003c/i\u003e Tween! \u003cb\u003eFoooooo!!\u003c/b\u003e\", 5f)\n            .WithRichText() // Enable RichText tags\n            .WithScrambleChars(ScrambleMode.All) // Fill unseen parts with random characters\n            .BindToText(tmpText); // Bind to TMP_Text (update text with zero allocation without generating strings)\n\n        LMotion.Punch.Create(0f, 5f, 2f) // Create a Punch motion (regular damping oscillation)\n            .WithFrequency(20) // Specify oscillation count\n            .WithDampingRatio(0f) // Specify damping ratio\n            .BindToPositionX(target2); // Bind to transform.position.x\n\n        // Control created motions via the `MotionHandle` struct\n        var handle = LMotion.Create(0f, 1f, 2f).RunWithoutBinding();\n\n        if (handle.IsActive()) // Returns true if the motion is playing\n        {\n            handle.Cancel(); // Cancel the motion\n            handle.Complete(); // Complete the motion\n        }\n    }\n    \n    // Animate TMP_Text characters\n    void TMPCharMotionExample()\n    {\n        // Get the number of characters from TMP_Text.textInfo.characterCount\n        for (int i = 0; i \u003c text.textInfo.characterCount; i++)\n        {\n            LMotion.Create(Color.white, Color.red, 1f)\n                .WithDelay(i * 0.1f)\n                .WithEase(Ease.OutQuad)\n                .BindToTMPCharColor(text, i); // Bind to the i-th character\n\n            LMotion.Punch.Create(Vector3.zero, Vector3.up * 30f, 1f)\n                .WithDelay(i * 0.1f)\n                .WithEase(Ease.OutQuad)\n                .BindToTMPCharPosition(text, i);\n        }\n    }\n\n    // Coroutine support\n    IEnumerator CoroutineExample()\n    {\n        var handle = LMotion.Create(0f, 1f, 2f).BindToUnityLogger();\n        yield return handle.ToYieldInteraction(); // Wait for completion in a coroutine\n    }\n\n    // async/await using UniTask\n    async UniTask AsyncAwaitExample(CancellationToken cancellationToken)\n    {\n        var handle = LMotion.Create(0f, 1f, 2f).BindToUnityLogger();\n        await handle; // Await MotionHandle directly\n        await handle.ToUniTask(cancellationToken); // Await with passing CancellationToken\n    }\n\n    // Convert to Observable\u003cT\u003e using R3\n    void RxExample()\n    {\n        LMotion.Create(0f, 1f, 2f)\n            .ToObservable() // Create motion as Observable\u003cT\u003e\n            .Where(x =\u003e x \u003e 0.5f) // Utilize R3 operators\n            .Select(x =\u003e x.ToString())\n            .Subscribe(x =\u003e\n            {\n                tmpText.text = x;\n            })\n            .AddTo(this);\n    }\n}\n```\n\n## Sequence\n\nThe Sequence feature is provided for combining multiple motions.\n\n```cs\nLSequence.Create()\n    .Append(LMotion.Create(0f, 1f, 1f).BindToPositionX(transform))\n    .Join(LMotion.Create(0f, 1f, 1f).BindToPositionY(transform))\n    .Insert(0f, LMotion.Create(0f, 1f, 1f).BindToPositionZ(transform))\n    .Run();\n```\n\nFor more details, refer to the [Sequence](https://annulusgames.github.io/LitMotion/articles/en/sequence.html) section in the documentation.\n\n## LitMotion.Animation\n\nLitMotion.Animation is an additional package that provides animation functionality built with LitMotion. \n\nBy introducing this package, you can use the LitMotion Animation component to construct animations in the Inspector.\n\n![img](./docs/images/img-litmotion-animation.gif)\n\n\n### Requirements\n\n* Unity 2021.3 or later\n* LitMotion 2.0.0 or later\n\n### Installation\n\nYou can install LitMotion using the Package Manager.\n\n1. Open Package Manager by navigating to Window \u003e Package Manager.\n2. Click on the \"+\" button and select \"Add package from git URL.\"\n3. Enter the following URL:\n\n```text\nhttps://github.com/annulusgames/LitMotion.git?path=src/LitMotion/Assets/LitMotion.Animation\n```\n\nAlternatively, you can open the `Packages/manifest.json` file and add the following line within the `dependencies` block:\n\n```json\n{\n    \"dependencies\": {\n        \"com.annulusgames.lit-motion.animation\": \"https://github.com/annulusgames/LitMotion.git?path=src/LitMotion/Assets/LitMotion.Animation\"\n    }\n}\n```\n\n### How to Use\n\nFor how to use LitMotion.Animation, please refer to the documentation on [LitMotion.Animation](https://annulusgames.github.io/LitMotion/articles/en/litmotion-animation-overview.html).\n\n## Performance\n\nHere are the benchmark results. The benchmark source code can be found in [this repository](https://github.com/annulusgames/TweenPerformance).\n\n### Tween 64,000 float properties\n\n#### Startup\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/benchmark_startup_64000_float.png\" width=\"800\"\u003e\n\n#### Update\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/benchmark_update_64000_float.png\" width=\"800\"\u003e\n\n### Tween 50,000 transform.position\n\n#### Startup\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/benchmark_startup_50000_position.png\" width=\"800\"\u003e\n\n#### Update\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/benchmark_update_50000_position.png\" width=\"800\"\u003e\n\n### GC Allocation (per position tween creation)\n\n\u003cimg src=\"https://github.com/annulusgames/LitMotion/blob/main/docs/images/benchmark_gc_position.png\" width=\"800\"\u003e\n\n## Support\n\nUntiy forum: https://forum.unity.com/threads/litmotion-lightning-fast-and-zero-allocation-tween-library.1530427/\n\n## License\n\n[MIT License](LICENSE)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannulusgames%2Flitmotion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fannulusgames%2Flitmotion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannulusgames%2Flitmotion/lists"}