{"id":13786180,"url":"https://github.com/phest/interpolations","last_synced_at":"2025-05-11T22:30:42.388Z","repository":{"id":75596131,"uuid":"183830693","full_name":"phest/interpolations","owner":"phest","description":"Lightweight Unity library for smoothing movements and value progressions in code (dragging, easing, tweening).","archived":false,"fork":false,"pushed_at":"2019-05-18T06:35:42.000Z","size":87,"stargazers_count":32,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T22:36:10.620Z","etag":null,"topics":["csharp","curve-interpolation","easing-functions","motion","smoothing","tweening","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phest.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":"2019-04-27T23:24:58.000Z","updated_at":"2024-05-20T19:24:32.000Z","dependencies_parsed_at":"2023-06-07T01:00:22.005Z","dependency_job_id":null,"html_url":"https://github.com/phest/interpolations","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phest%2Finterpolations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phest%2Finterpolations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phest%2Finterpolations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phest%2Finterpolations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phest","download_url":"https://codeload.github.com/phest/interpolations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253645081,"owners_count":21941311,"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":["csharp","curve-interpolation","easing-functions","motion","smoothing","tweening","unity3d"],"created_at":"2024-08-03T19:01:11.108Z","updated_at":"2025-05-11T22:30:41.948Z","avatar_url":"https://github.com/phest.png","language":"C#","readme":"\n# Interpolations\n\nLightweight Unity library for smoothing movements and value progressions in code\n(dragging, easing, tweening).\n\nhttps://twitter.com/stephbysteph/status/1125462189450465280\n\n**API is currently experimental and may change.**\n\n## Current Features\n\n- Drag outs\n    - On the fly dampening of changes over time (float and Vector3)\n    - Optional control and status of snapping\n- Easings\n    - Robert Penner easing equations, optimized\n    - Easings methods pluggable to Unity's Lerp methods\n- Tweens\n    - Lightweight and flexible tweening suite\n    - Tween class extendable with two one-line methods\n    - If needed, direct control over Tween instances and updating,\n      for specific requirements in update timing or instancing\n    - Optional runner abstraction handling instances and updates,\n      with choice over which update event function to update within\n    - Optional abstraction sugar for different tween types\n    - Tween characteristics can be modified while tweening, for dynamic changes\n    - Tween instances can be reused, yo-yo-ed, or recycled\n    - Tween easings configurable through editor\n    - Pure tweens for tweens without side effects\n    - Closure tweens for custom tween instances (Float, Vector2-3, Quaternion, Color)\n    - Convenience tweens for Transform control (Position, Rotation, Scale)\n\n## Examples\n\n### Smoothing out sudden value changes \n\n``` c#\n// (Within an update call, i.e. FixedUpdate)\nmixer.volume = Volume;\n                 |\n                 v\nmixer.volume = mixer.volume.DragOut(Volume, 30);\n```\n\n### Adding easing to a lerp call\n\n``` c#\nVector3.Lerp(a, b, ratio);\n                     |\n                     v\nVector3.Lerp(a, b, I.Cubic.InOut(ratio));\n```\n\nCheck this [cheat sheet](https://easings.net/en) for the effect of the different equations.\n\n### Tweening a position, the abstracted way\n\n``` c#\nTweens.Run(new PositionTween(transform))\n      .To(targetPosition)\n      .Timing(0, 1, I.Circ.InOut);\n```\n\nor using a shortcut:\n\n``` c#\nTweens.RunPosition(transform)\n      .To(targetPosition)\n      .Timing(0, 1, I.Circ.InOut);\n```\n\nor having it update within `FixedUpdate`/`LateUpdate` instead of `Update`:\n``` c#\nTweens.Fixed.Run...\nTweens.Late.Run...\n```\n\n### Tweening a position, the controlling way\n\n``` c#\nTween\u003cVector3\u003e positionTween;\n...\npositionTween = new PositionTween(transform))\n      .To(targetPosition)\n      .Timing(0, 1, I.Circ.InOut)\n      .Start();\n...\n// In Update, FixedUpdate, or etc\npositionTween.Update(Time.timeDelta)\n\n```\n\n### Custom tweening instances\n\n``` c#\nTweens.RunFloat\n(\n    () =\u003e mixer.GetFloat(\"sfxVol\", out float vol) ? vol : 0,\n    vol =\u003e\n    {\n        mixer.SetFloat(\"sfxVol\", vol);\n        indicator.alpha = vol;\n    }\n)\n.To(targetVolume)\n.Timing(0, 1, I.Sine.Out);\n\n```\n\n``` c#\nTweens.Run(new ColorTween(myScript.GetColor, myScript.SetColor))\n      .To(Color.yellow)\n      .Timing(0, 1, I.Cubic.InOut);\n```\n\n\n## Features Roadmap\n\n- Pre-setter value processor closure in Tween\n- More drag out types (Color, Quaternion, Vector2, etc)\n- More closure tween types (Vector4, etc)\n- Documentation\n\n### Possible features\n\n- More convenience tweens for Unity classes (CanvasGroup, Image, etc)\n- Eased sliders (editor and UI)\n- Bezier and CatmullRom Interpolations\n\n## Meta\n\nInterpolations\nhttps://github.com/phest/interpolations \n\nBy [Steph Thirion](http://trsp.net).\n\nEasing equations by [Robert Penner](http://robertpenner.com/easing), optimized by [Tween.js authors](https://github.com/tweenjs/tween.js/).\n\nAll code open source under MIT License. See [LICENSE file](https://github.com/phest/interpolations/blob/master/LICENSE). \n\n","funding_links":[],"categories":["Easing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphest%2Finterpolations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphest%2Finterpolations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphest%2Finterpolations/lists"}