load #easingcheatsheet |
in the Pico-8 command line to load it straight into your Pico-8 application!
Easing functions are ways of modifying the rate of change for a linear interpolation function. You may have used these in animation programs (unity, blender, etc.) by manually editing animation curves. This editing isn't all that possible without a large engine backend, but you can easily create short math equations to imitate some of the commonly used curves. This is what I've done here, implementing a set of functions for these curves, and creating a little demo so you can see how each of them changes your interpolation!
Code
All of these functions are completely self sufficient (don't rely on anything outside the function), so you can easily pick and choose which ones you want! (476 tokens for all of them)
(also, none of the functions have any safety regulations, so passing values outside of 0-1 will result in unintended behavior. Be careful! you could also add t=mid(0,t,1) to the start of the functions to clamp the values)
Quadratic functions
Quartic functions
(these are very similar to quadratics, but flatter at the start and steeper towards the end)
Overshooting functions
(these functions overshoot the range slightly and then return to it)
Elastic functions
(these functions overshoot slightly and then oscillate near the edges of the range, like an elastic band)
Bouncing functions
(these functions hit the edge values early, then bounce back a few times)
Other useful functions:
Crediting:
If you use these in your own code, please just put a link to this BBS post in a comment near the function! I want to allow anyone reading your code to be able to find this and use it as well, for learning purposes.
All of the easing functions in this cart are based/translated from this site: https://easings.net/
Also, feel free to suggest any functions I'm missing! I omitted some of the functions that I thought were redundant/not commonly used, but correct me if I was wrong with that assumption!
@TBMcQueen those are at the bottom of the menu, after all of the other curves! I added them after I originally posted so they weren't mixed in with the others.
[Please log in to post a comment]



