Game Maker - Easing Curves
A downloadable Code
Do you like the lerp function? Did you ever wish there were ways to interpolate between two numbers in non-linear manners? Do you like easing curves? Here's a bit of easy-to-use easing curve code.
Usage (and uses)
I put this together for use in animation. There are probably other uses for these, feel free to be creative about them. All of the scripts take the same argument list, which is
ease(value_start, value_end, fraction, curve_type)
where a fraction value of 0 produces value_start, a fraction value of 1 produces value_end and a fraction value in between produces something in the middle, depending on the easing curve. Most of the time that's all you'll use, although if you want to extrapolate you can use fraction values less than zero or greater than one. curve_type can be either the name of one of the animation curve channels or a member of the Easings enum.
Documentation
Can be found here.
Notes
I mentioned animation, but it's important to note that this will not do any animation for you. It just does a little bit of annoying math so that you don't have to.
If you want to visualize what these curves, and some others, look like you might like easings.net. I might make a nice demo program at some point later.
This is also on the marketplace, if you like to collect stuff there. It's several versions out of date because updating stuff on the Marketplace is a nightmare.
Download
Install instructions
Download the yymp file, go to the Tools menu in GameMaker Studio 2 and select Import Local Package. Find the file. It will import the scripts into your project.
Development log
- Some small changesApr 16, 2022
Comments
Log in with itch.io to leave a comment.
love this
stupidly convenient, thank you very much!!