{"id":17037227,"url":"https://github.com/tomblind/unity-async-tweens","last_synced_at":"2025-04-12T13:21:10.835Z","repository":{"id":217165073,"uuid":"158888666","full_name":"tomblind/unity-async-tweens","owner":"tomblind","description":"Tween Extension to Unity-AsyncRoutines","archived":false,"fork":false,"pushed_at":"2019-10-31T21:42:35.000Z","size":14,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T08:01:31.416Z","etag":null,"topics":["animation","async","await","coroutines","routines","tween","unity","unity3d"],"latest_commit_sha":null,"homepage":null,"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/tomblind.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}},"created_at":"2018-11-24T00:15:18.000Z","updated_at":"2025-01-31T17:39:10.000Z","dependencies_parsed_at":"2024-01-14T22:44:16.659Z","dependency_job_id":null,"html_url":"https://github.com/tomblind/unity-async-tweens","commit_stats":null,"previous_names":["tomblind/unity-async-tweens"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomblind%2Funity-async-tweens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomblind%2Funity-async-tweens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomblind%2Funity-async-tweens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomblind%2Funity-async-tweens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomblind","download_url":"https://codeload.github.com/tomblind/unity-async-tweens/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571836,"owners_count":21126522,"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","async","await","coroutines","routines","tween","unity","unity3d"],"created_at":"2024-10-14T08:53:12.642Z","updated_at":"2025-04-12T13:21:10.814Z","avatar_url":"https://github.com/tomblind.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unity AsyncTweens\nTween Extension to [Unity-AsyncRoutines](https://github.com/tomblind/unity-async-routines)\n\n## Basic Usage\n```cs\nusing AsyncRoutines;\nusing AsyncTweens;\n\npublic class Foo : MonoBehaviour\n{\n    public RoutineManagerBehavior routineManager;\n\n    public void Start()\n    {\n        routineManager.Run(Bar());\n    }\n\n    public async Routine Bar()\n    {\n        //Tween self to 1,1,0 over 2 seconds\n        await Tween.Position.To(transform, new Vector3(1, 1, 0), 2);\n\n        //Tween to a relative position from the current\n        await Tween.Position.ToOffset(transform, new Vector3(-1, -1, 0), 2);\n\n        //Tween from a position to the current\n        await Tween.Position.From(transform, new Vector3(2, 2, 0), 2);\n    }\n}\n```\n\nAside from position, there are built-in tweeners for other Transform properties (eulerAngles, localScale, etc...) and properties on other objects as well (SpriteRenderer.color, RectTransform.anchoredPosition, etc...).\n\n## Easings\nTweeners optionally take an easing function to control the speed throughout the animation. For convenience, a number of standard curves have built-in functions. You may also write your own custom easing function. Another option is to use a Unity AnimationCurve and pass its `Evaluate` method.\n\n```cs\npublic class Foo : MonoBehaviour\n{\n    public AnimationCurve curve;\n\n    public async Routine Bar()\n    {\n        //Built-in curve function\n        await Tween.Position.To(transform, new Vector3(0, 0, 0), 2, Easing.QuadInOut);\n\n        //Custom easing function\n        await Tween.Position.To(transform, new Vector3(1, 1, 0), 2, MyCustomEasing);\n\n        //AnimationCurve\n        await Tween.Position.To(transform, new Vector3(2, 2, 0), 2, curve.Evaluate);\n    }\n\n    public static float MyCustomEasing(float i)\n    {\n        return i * i;\n    }\n}\n```\n\nYou can also use the `Easing` type to enable setting the function from Unity's Inspector window.\n```cs\npublic class Foo : MonoBehaviour\n{\n    public Easing easing; //Allows you to select a built-in easing function or set an animation curve\n\n    public async Routine Bar()\n    {\n        await Tween.Position.To(transform, new Vector3(2, 2, 0), 2, easing);\n    }\n}\n```\n\n## Custom Tweeners\nMore tweeners for common Unity properties will be added over time, but you can add your own easily.\n```cs\nusing AsyncRoutines;\nusing AsyncTweens;\nusing UnityEngine.Tilemaps;\n\npublic class Foo : MonoBehaviour\n{\n    public static Tweener\u003cColor, Tilemap\u003e tilemapColorTweener = new Tweener\u003cColor, Tilemap\u003e(\n        (tilemap) =\u003e tilemap.color, // getter\n        (tilemap, color) =\u003e tilemap.color = color //setter\n    );\n\n    public Tilemap tilemap;\n\n    public async Routine Bar()\n    {\n        await tilemapColorTweener.To(tilemap, Color.black, 1);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomblind%2Funity-async-tweens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomblind%2Funity-async-tweens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomblind%2Funity-async-tweens/lists"}