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 bunch of easing curve scripts. The math is from the page above, I just packaged it up for use in Game Maker.

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 

easing_function(value_start, value_end, fraction)

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.

Notes

I did some really fast testing and I'm like 55% sure they produce the outputs that they're supposed to (i.e. I didn't make any errors copying it in). If there are any off-by-one errors or anything, I'll fix them as soon as I learn about them.

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.

This is also on the marketplace, if you like to collect stuff there.

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.

Download

Download
easingcurves.yymp 16 kB

Leave a comment

Log in with itch.io to leave a comment.