{"id":29172008,"url":"https://github.com/setanarut/tween","last_synced_at":"2026-01-24T02:10:39.338Z","repository":{"id":294764518,"uuid":"987996588","full_name":"setanarut/tween","owner":"setanarut","description":"Tweening package for Go","archived":false,"fork":false,"pushed_at":"2025-05-21T23:23:14.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T00:32:39.766Z","etag":null,"topics":["easing","easing-curves","easing-functions","go","golang","tween","tween-animation","tweening","tweening-library"],"latest_commit_sha":null,"homepage":"","language":"Go","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/setanarut.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,"zenodo":null}},"created_at":"2025-05-21T22:44:54.000Z","updated_at":"2025-05-21T23:21:50.000Z","dependencies_parsed_at":"2025-05-22T12:31:18.209Z","dependency_job_id":null,"html_url":"https://github.com/setanarut/tween","commit_stats":null,"previous_names":["setanarut/tween"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/setanarut/tween","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Ftween","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Ftween/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Ftween/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Ftween/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/setanarut","download_url":"https://codeload.github.com/setanarut/tween/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Ftween/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262969875,"owners_count":23392530,"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":["easing","easing-curves","easing-functions","go","golang","tween","tween-animation","tweening","tweening-library"],"created_at":"2025-07-01T13:10:00.683Z","updated_at":"2026-01-24T02:10:39.333Z","avatar_url":"https://github.com/setanarut.png","language":"Go","readme":"# Tween [![](https://godoc.org/github.com/setanarut/tween?status.svg)](http://godoc.org/github.com/setanarut/tween)\n\nTween is a small library to perform [tweening](https://en.wikipedia.org/wiki/Tweening) in Go. It has a minimal\ninterface, and it comes with several easing functions.\n\n## Quick start\n\nTween usage\n\n```Go\nfunc main() {\n\t// tween from 0 to 1 in 3 seconds\n\ttw := tween.NewTween(0, 1, 3*time.Second, tween.Linear, false)\n\n\t// advance by 1.5 seconds\n\ttw.Update(time.Millisecond * 1500)\n\n\t// get tween value at 1.5 seconds\n\tfmt.Println(tw.Value) // 0.5\n\n\t// merge multiple tweens into a sequence\n\tsequence := tween.NewSequence(\n\t\ttween.NewTween(0, 100, 3*time.Second, tween.InCubic, false),\n\t\ttween.NewTween(100, 40, 2*time.Second, tween.OutCubic, false),\n\t\ttween.NewTween(4, 100, 20*time.Second, tween.InOutBounce, false),\n\t)\n\n\t// advance by 7.5 seconds\n\tsequence.Update(time.Millisecond * 7500)\n\n\t// get sequence value at 7.5 seconds\n\tfmt.Println(sequence.Value) // 5.3125\n}\n\n```\n\nSee [examples](./examples/) folder for more examples.\n\n## Easing functions\n\nEasing functions are functions that express how slow/fast the interpolation happens in tween.\n\n![tween-families](https://github.com/user-attachments/assets/b364ff8d-bc7b-4b35-82ac-d89bf0eec933)\n\nThe easing functions can be found in the `ease` package.\n\nThey can be divided into several families:\n\n* `linear` is the simplest easing function, straight from one value to the other.\n* `quad`, `cubic`, `quart`, `quint`, `expo`, `sine` and `circle` are all \"smooth\" curves that will make transitions look natural.\n* The `back` family starts by moving the interpolation slightly \"backwards\" before moving it forward.\n* The `bounce` family simulates the motion of an object bouncing.\n* The `elastic` family simulates inertia in the easing, like an elastic gum.\n\nEach family (except `linear`) has 4 variants:\n* `In` starts slow, and accelerates at the end\n* `Out` starts fast, and decelerates at the end\n* `InOut` starts and ends slow, but it's fast in the middle\n* `OutIn` starts and ends fast, but it's slow in the middle\n\n| family      | in        | out        | inOut        | outIn        |\n| ----------- | --------- | ---------- | ------------ | ------------ |\n| **Linear**  | Linear    | Linear     | Linear       | Linear       |\n| **Quad**    | InQuad    | OutQuad    | InOutQuad    | OutInQuad    |\n| **Cubic**   | InCubic   | OutCubic   | InOutCubic   | OutInCubic   |\n| **Quart**   | InQuart   | OutQuart   | InOutQuart   | OutInQuart   |\n| **Quint**   | InQuint   | OutQuint   | InOutQuint   | OutInQuint   |\n| **Expo**    | InExpo    | OutExpo    | InOutExpo    | OutInExpo    |\n| **Sine**    | InSine    | OutSine    | InOutSine    | OutInSine    |\n| **Circ**    | InCirc    | OutCirc    | InOutCirc    | OutInCirc    |\n| **Back**    | InBack    | OutBack    | InOutBack    | OutInBack    |\n| **Bounce**  | InBounce  | OutBounce  | InOutBounce  | OutInBounce  |\n| **Elastic** | InElastic | OutElastic | InOutElastic | OutInElastic |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetanarut%2Ftween","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetanarut%2Ftween","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetanarut%2Ftween/lists"}