{"id":13661510,"url":"https://github.com/kyubuns/AnimeTask","last_synced_at":"2025-04-25T02:33:29.290Z","repository":{"id":40343963,"uuid":"150962956","full_name":"kyubuns/AnimeTask","owner":"kyubuns","description":"Task Animation Library for Unity","archived":false,"fork":false,"pushed_at":"2024-03-06T08:04:15.000Z","size":272,"stargazers_count":381,"open_issues_count":0,"forks_count":32,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-05-02T01:04:27.124Z","etag":null,"topics":["animation","tween","unity"],"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/kyubuns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["kyubuns"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/kyubuns"]}},"created_at":"2018-09-30T11:52:20.000Z","updated_at":"2024-05-01T04:12:42.000Z","dependencies_parsed_at":"2024-03-06T08:26:56.840Z","dependency_job_id":"666750b5-f4f2-4606-8951-67c2ec057457","html_url":"https://github.com/kyubuns/AnimeTask","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyubuns%2FAnimeTask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyubuns%2FAnimeTask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyubuns%2FAnimeTask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyubuns%2FAnimeTask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyubuns","download_url":"https://codeload.github.com/kyubuns/AnimeTask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250742112,"owners_count":21479734,"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","tween","unity"],"created_at":"2024-08-02T05:01:36.081Z","updated_at":"2025-04-25T02:33:28.868Z","avatar_url":"https://github.com/kyubuns.png","language":"C#","readme":"# AnimeTask\n\nTask Animation Library for Unity  \n\n---\n\n\u003e [!WARNING]\n\u003e This is also a very old library.  \n\u003e If you want to use a new one now, I recommend [PrimeTween](https://github.com/KyryloKuzyk/PrimeTween).\n\n---\n\n***Read this document in other languages: [日本語](https://github.com/kyubuns/AnimeTask/blob/main/README_ja.md)***\n\n![gif_animation_001](https://user-images.githubusercontent.com/961165/85940937-8c48d500-b95a-11ea-81b5-fddd17166a96.gif)\n\n## Sample\n\n-\u003e [Example of use](https://github.com/kyubuns/AnimeTask/wiki/Gallery)\n\n### Basic\n\nMove from `(-5f, 0f, 0f)` to `(5f, 0f, 0f)` over 2 seconds.\n\n```csharp\nawait Easing.Create\u003cLinear\u003e(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cube);\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/961165/85938659-32d8aa00-b94a-11ea-84e4-162626e31861.gif\" width=\"480\"\u003e\n\n### `PlayTo`\n\nMove from the current location to a specified location.\n\n```csharp\nawait Easing.Create\u003cLinear\u003e(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube);\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/961165/85938725-b5fa0000-b94a-11ea-8c4c-2b20b2090561.gif\" width=\"480\"\u003e\n\n### Easing\n\nUse [`InCubic`](https://easings.net/#easeInCubic) of [`Easing`](https://easings.net/) to move to a specified position.\n\n```csharp\nawait Easing.Create\u003cInCubic\u003e(new Vector3(-5f, 3f, 0f), 2f).ToLocalPosition(cube);\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/961165/85938690-6d424700-b94a-11ea-9f8a-9bccddabf6b3.gif\" width=\"480\"\u003e\n\n### Linear\n\nMove at 1 per second for 2 seconds.\n\n```csharp\nawait Moving.Linear(1f, 2f).ToLocalPositionX(cube);\n```\n\n### `Gravity`\n\n```csharp\nconst float xRange = 5f;\nconst float yRangeMin = 5f;\nconst float yRangeMax = 10f;\nawait Moving.Gravity(\n          new Vector2(Random.Range(-xRange, xRange), Random.Range(yRangeMin, yRangeMax)),\n          Vector2.down * 9.8f,\n          5f\n      ).ToLocalPosition(shape)\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/961165/85940937-8c48d500-b95a-11ea-81b5-fddd17166a96.gif\" width=\"480\"\u003e\n\n### `AnimationCurve`\n\n```csharp\n[SerializeField] private AnimationCurve sample12 = default;\n\npublic async UniTask Sample12()\n{\n    await Moving.AnimationCurve(sample12).ToLocalPositionX(cube);\n}\n```\n\n### CalcDuration\n\nMove by calculating moving time from distance.\n\n```csharp\nawait Easing.Create\u003cOutCubic\u003e(new Vector3(5f, 0f, 0f), x =\u003e x / 2f)\n    .Concat(Easing.Create\u003cOutCubic\u003e(new Vector3(5f, 2f, 0f), x =\u003e x / 2f))\n    .Concat(Easing.Create\u003cOutCubic\u003e(new Vector3(-5f, 0f, 0f), x =\u003e x / 2f))\n    .ToLocalPosition(cubes);\n```\n\n### `TranslateTo.Action`\n\n`TranslateTo.Action` enables you to use the animated values freely.\n\n```csharp\nEasing.Create\u003cLinear\u003e(0, 100, 2f).ToAction\u003cfloat\u003e(x =\u003e Debug.Log(x))\n```\n\n### `UnscaledTime`\n\nYou can create your own scheduler, so you can stop time for specific objects.  \nThe default is to use `Time.time`, and you can also use `UnscaledTimeScheduler`, which uses `Time.unscaledTime`.\n\n```csharp\nEasing.Create\u003cLinear\u003e(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), 2f)\n    .ToLocalPosition(shape, default, new UnscaledTimeScheduler());\n```\n\n### Update Timing\n\nIf an update timing is specified in the scheduler, values can be updated at times other than Update.\n\n```csharp\npublic class CustomScheduler : IScheduler\n{\n    public float DeltaTime =\u003e Time.deltaTime;\n    public PlayerLoopTiming UpdateTiming =\u003e PlayerLoopTiming.PreUpdate;\n}\n```\n\n### `Cancel`\n\n```csharp\nvar cancellationTokenSource = new CancellationTokenSource();\ncancellationTokenSource.Token.Register(() =\u003e Debug.Log(\"Cancel\"));\ncancellationTokenSource.CancelAfter(500);\n\nawait Easing.Create\u003cOutCubic\u003e(new Vector3(5f, 0f, 0f), 2f).ToLocalPosition(cubes[0], cancellationTokenSource.Token);\n```\n\n### `Convert`\n\nConvert a `float` transition to a circular motion.\n\n```csharp\nawait Easing.Create\u003cOutCubic\u003e(0.0f, Mathf.PI * 2.0f, 2f)\n    .Convert(x =\u003e new Vector3(Mathf.Sin(x), Mathf.Cos(x), 0.0f) * 3.0f)\n    .ToLocalPosition(go);\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/961165/85940836-ef863780-b959-11ea-94a3-11e9ed5057f4.gif\" width=\"480\"\u003e\n\n### `Concat`\n\nIt moves from 5f to 0f in 2 seconds, stops for 1 second, and moves to -5f in 2 seconds.\n\n```csharp\nawait Easing.Create\u003cOutCubic\u003e(5f, 0f, 2f)\n    .Delay(1f)\n    .Concat(Easing.Create\u003cOutCubic\u003e(0f, -5f, 2f))\n    .ToLocalPositionX(cubes[0]);\n```\n\n### `IProgress`\n\nSupporting [IProgress](https://docs.microsoft.com/ja-jp/dotnet/api/system.iprogress-1)\n\n```csharp\nawait Easing.Create\u003cLinear\u003e(2f).ToProgress(Progress.Create\u003cfloat\u003e(x =\u003e Debug.Log(x)));\n```\n\n### `AnimationCanceller`\n\n```csharp\nvar canceller = go.GetAnimationCanceller().Cancel();\nEasing.Create\u003cLinear\u003e(1.0f, 0.5f).ToLocalPositionX(go, canceller.Token);\n\n// in other class/scope\nvar canceller = go.GetAnimationCanceller().Cancel();\nEasing.Create\u003cLinear\u003e(0.0f, 0.5f).ToLocalPositionX(go, canceller.Token);\n```\n\n### `Skip`\n\n- Cancel (using CancellationToken) will stop at the position at the moment of `Cancel`.\n- Skip (using SkipToken) will move to the last position at the moment of `Skip`.\n\n```csharp\nvar skipTokenSource = new SkipTokenSource();\nEasing.Create\u003cOutCubic\u003e(new Vector3(5f, 0f, 0f), 5f).ToLocalPosition(cubes[0], default, skipTokenSource.Token).Forget();\nawait UniTask.Delay(TimeSpan.FromSeconds(1));\nskipTokenSource.Skip();\n```\n\n### `UniRx.Extensions`\n\n```csharp\nvar score = new ReactiveProperty\u003cint\u003e(0);\nscore\n    .SubscribeTask(async (x, cancellationToken) =\u003e\n    {\n        scoreCounter.text = $\"{x}\";\n        await Easing.Create\u003cOutBounce\u003e(2f, 1f, 0.5f).ToLocalScale(scoreCounter, cancellationToken);\n    });\n```\n\n## Instructions\n\n- Import AnimeTask via Package Manager\n  - `https://github.com/kyubuns/AnimeTask.git?path=Assets/AnimeTask`\n- Import AnimeTask via UnityPackage\n  - Import [UniTask](https://github.com/Cysharp/UniTask)\n  - Import [UnityPackage](https://github.com/kyubuns/AnimeTask/releases)\n\n## Way of thinking\n\nYou can pass two arguments to `Play` and `PlayTo`.  \nThe first is the `Animator` and the second is the `Translator`, which have distinct roles.\n\n### Animator\n\nTakes the elapsed time and returns the current value.\n\n### Translator\n\nReflect the value.\n\n## Requirements\n\n- Requires Unity2020.3 or later\n\n## License\n\nMIT License (see [LICENSE](LICENSE))\n","funding_links":["https://github.com/sponsors/kyubuns","https://www.buymeacoffee.com/kyubuns"],"categories":["Animation","C\\#","Open Source Repositories","C#","Easing"],"sub_categories":["Animation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyubuns%2FAnimeTask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyubuns%2FAnimeTask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyubuns%2FAnimeTask/lists"}