{"id":13525098,"url":"https://github.com/JoebRogers/PICO-Tween","last_synced_at":"2025-04-01T04:31:05.248Z","repository":{"id":37412609,"uuid":"127534323","full_name":"JoebRogers/PICO-Tween","owner":"JoebRogers","description":"A small library of tweening/easing functions for use in the PICO-8 fantasy console, inspired by Robert Penner's easing functions.","archived":false,"fork":false,"pushed_at":"2020-03-25T05:11:32.000Z","size":243,"stargazers_count":84,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T16:04:19.704Z","etag":null,"topics":["easing","easing-functions","easings","game","game-2d","game-dev","game-development","game-engine","gamedev","games","lua","lua-library","pico-8","pico8","tween","tweening"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/JoebRogers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-31T13:26:47.000Z","updated_at":"2025-03-07T15:08:52.000Z","dependencies_parsed_at":"2022-08-18T04:10:14.120Z","dependency_job_id":null,"html_url":"https://github.com/JoebRogers/PICO-Tween","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoebRogers%2FPICO-Tween","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoebRogers%2FPICO-Tween/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoebRogers%2FPICO-Tween/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoebRogers%2FPICO-Tween/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoebRogers","download_url":"https://codeload.github.com/JoebRogers/PICO-Tween/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586053,"owners_count":20801024,"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-functions","easings","game","game-2d","game-dev","game-development","game-engine","gamedev","games","lua","lua-library","pico-8","pico8","tween","tweening"],"created_at":"2024-08-01T06:01:15.922Z","updated_at":"2025-04-01T04:31:04.993Z","avatar_url":"https://github.com/JoebRogers.png","language":"Lua","funding_links":[],"categories":["Uncategorized","Lua"],"sub_categories":["Uncategorized"],"readme":"[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/JoebRogers/PICO-Tween/graphs/commit-activity) \n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://en.wikipedia.org/wiki/MIT_License) \n[![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://joebrogers.com) \n[![Twitter Follow](https://img.shields.io/twitter/follow/JoebMakesGames.svg?style=social\u0026label=Follow)](https://twitter.com/JoebMakesGames)\n[![Made With PICO-8](https://img.shields.io/badge/Made%20With-PICO--8-ff004d.svg?style=flat\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAlUlEQVQ4jWP8v5gBFTxOR%2BVXPfuPwp8SxIjCt%2BBG4TIxUBkMfgNZGIyi0IRmoobZxxeo0rcPocp%2FEEEJ08HvZaobyPj%2FjTpqmLAeJM2EtgMo3MHvZeqnw9X%2FXVHSUdhnP5Qw%2Fc%2B7CUVDS%2BsWFH6QpuyIT4cMT8xQBJI%2B1aHwj1%2F3RgnTVJbrKGH29egxFPWD38tUNxAAun4liexlTtMAAAAASUVORK5CYII%3D)](https://www.lexaloffle.com/pico-8.php)\n\n![PICO-Tween](img/logo.gif)\n\nPICO-Tween is a port of the easing functions developed by Robert Penner. This port was based on the Lua port by EmmanuelOga \nand optimised to suit the PICO-8 by refactoring to remove unnecessary tokens and making it compatible with the way the PICO-8\nhandles math functions.\n\nSome important things to note:\n\n- Despite being optimised, this library as a whole is still huge. It would be in your best interests to grab only\nthe functions you plan on using, along with their support functions/variables.\n\n- The overall token count for the library is ~~1556~~ 2083, with an average of around 40-60 tokens per easing function.\n\n- ~~This library has had the elastic easing functions removed as they relied on asin and acos, which are not\navailable within the PICO-8. My math skills do not extend far enough for me to implement a solution for them \nthat doesn't rely on those functions.~~\n\n- Thanks to the Nvidea CG Toolkit references, the library now comes with implementations of asin and acos. This means\nthat elastic easings have been reincluded and should be working as intended.\n\n- An important thing to note is that in order for the sine easings to work correctly, I've used the radian based\nconversion for the base sin and cos functions without the y inversion:\n```lua\ncos1 = cos function cos(angle) return cos1(angle/(3.1415*2)) end\nsin1 = sin function sin(angle) return sin1(-angle/(3.1415*2)) end\n```\nIf you rely on sin and cos within your game and don't want to use radian based angles, then you'll need to adapt your\ninput to the easing function accordingly to perform these calculations manually.\n\n## PICO-TweenMachine\n\nAlongside this library, I've also released an extension library to act as a support for this. It's a lightweight wrapper\nto help drive and manage all tween objects and related code in order to reduce boilerplate and mess, as well as simplify\nthe process of creating and using tweens.\n\nYou can view the repository here: [PICO-TweenMachine](https://github.com/JoebRogers/PICO-TweenMachine).\n\n## Setup\n\nLike any PICO-8 library, integrating this library into your cart is as simple as copy/pasting the source\ninto the top of your code (I recommend the top in order to avoid problems with object ordering).\n\nIf you only need a small number of easing functions and are planning on using them individually, be sure to \ncheck for their dependencies. For example, there is a definition of Pi at the top of the library that might need to be\ncopied over, along with radian based sin and cos function redefinitions used within the sine easing functions.\n\n## Basic Usage\n\nAny of these functions should be simple to just plug in and play, provided you have a basic knowledge of how to use\neasing functions.\n\nHere is a basic example of using the linear function to move across the screen:\n\n```lua\nfunction linear(t, b, c, d)\n  return c * t / d + b\nend\n\nlocal distance = 50\nlocal duration = 1\n\nfunction downFunc(v)\n  return linear(v, 0, distance, duration)\nend\n\nfunction upFunc(v)\n  return linear(v, distance, -distance, duration)\nend\n\nlocal easeProp = 0\nlocal timeElapsed = 0\nlocal currentFunc = downFunc\nlocal lastTime = time()\nlocal dt = 0\n\nfunction _update()\n  t = time()\n  dt = t - lastTime\n  lastTime = t\n  timeElapsed += dt\n\n  if timeElapsed \u003e duration then\n    timeElapsed = 0\n    if currentFunc == downFunc then currentFunc = upFunc else currentFunc = downFunc end\n  end\n\n  easeProp = currentFunc(timeElapsed)\nend\n\nfunction _draw()\n  rectfill(0, 0, 128, 128, 3)\n  circfill(64, 40 + easeProp, 20, 15)\nend\n```\n\nYou should get the following results:\n\n![Basic Usage Demo](img/basic-usage-demo.gif)\n\n## Examples\n\nYou can find a test cart that allows you to cycle through all of the easing functions in the [cart](cart/pico-tween-demo.p8) folder \nif you want to load it up into the console and play around with it!\n\nHere are some example gifs:\n\n![Bounce Out](img/bounce-out.gif)\n\n![Out In Cubic](img/out-in-cubic.gif)\n\n## Credits\n\nThis library port wouldn't have been possible without the original easings functions by [Robert Penner.](http://robertpenner.com/easing/)\n\nIt also wouldn't have been anywhere near as easy without the Lua port for the functions by [EmmanuelOga](https://github.com/EmmanuelOga/easing)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJoebRogers%2FPICO-Tween","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJoebRogers%2FPICO-Tween","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJoebRogers%2FPICO-Tween/lists"}