JUST A HEADS UP -------------------
With the addition of Animation Curves, this script is kinda unnecessary now. I'll leave it up for those who still prefer using a single script to defining and using animcurves, but I've personally stopped using twerp.

We had a good run, buddy.
------------------------------------------


Twerp is an easing function for GameMaker Studio 2 that functions similar to the lerp() function, but allows you to select from many easing algorithms to augment how the value changes over time.

Here is how I typically use twerp:
You need 4 things to start, often defined in the create event.
1. A start value.
2. An end value.
3. A length for the transition from start to end (typically in steps)
4. And a timer to keep track of how long the current transition has been going.

So my create event might look like this:

timer = 0;
length = room_speed * 2;
start = 50;
end = 150;

Then my Step Event:

timer++;
x = twerp(TwerpType.inout_cubic, start, end, timer / length);

And it's really that simple.  

StatusReleased
CategoryAssets
Rating
Rated 4.6 out of 5 stars
(5 total ratings)
AuthorPixelated Pope
Made withGameMaker

Download

Download NowName your own price

Click download now to get access to the following files:

TwerpDemoProjectSource.yyz 81 kB
twerp.gml 7 kB

Development log

Comments

Log in with itch.io to leave a comment.

inout_back is broken btw

at the end of the animation it just goes to the center of the screen horizontally

Odd. In all honesty, you really should be using animation curves now...

(+6)

Really great, but I'm honestly most impressed by this page.

(+5)

Yep, me too. Still great tool tho, i am gonna use this for sure.

(+5)

I'll add the demo project source to the available files for people who want to see how I did it.  It's really nothing fancy.