Docs: tweenline2

Getting Started

Setup Tweenline

You can download the Tweenline Animation Engine from the Game Maker Studio Marketplace. Once you have adquired Tweenline from the marketplace, you only need to do the following:

To view the demo files:

  1. Import ALL the files into a NEW project
  2. Press the "Play" button in GameMaker Studio 2.

To Import the basic tweenline2 SDK extension into your project:

  1. Open your existig project or create a new empty project
  2. Import the Following folders:
  1. If you want to use the advanced visual debugging features, you can also import:


Your First Tween

A tween is an Animation (interpolation of values) of one or more variables of an instance during a period of time. To create your first Tween, add the following code to the creation event of an object, and place it in an empty room. This will tween the x variable of the current object from the current value to the value 300 in 2 seconds and then, stop.

tween_to(id, 2, ["x", 300]);

Congratulations! You have created your first Tween animation.

Multiple variables

You can also, animate multiple variables using the same tween:

tween_to(obj_box, 5, ["x", x + 200, "y", y + 300, "image_angle", 90]);

Variable Aliases

Some of the most used variables, like image_angle, image_xscale, image_blend, etc have aliases like "angle", "xscale" and "blend". To check the full list of aliases, check tween_system_add_alias script. So, you can rewrite the last tween like this:

tween_to(obj_foo, 5, ["x", x + 200, "y", y + 300, "angle", 90]);

Control an Animation

You can save a reference to the tween in a variable, and then use all the anim_* functions, to control the tween:

my_tween = tween_to(id, 2.5, ["blend", c_red]); // Blend to red in 2.5 seconds.
// Then you can play, pause, seek, reverse, timescale, and more!
anim_seek(my_tween, 1.2);
anim_set_timescale(my_tween, 0.5);

Check all the functions inside the Animation folder for more.

tween_from, tween_to and tween_fromto

Currently, you are tweening your variables from the current value to a final value that you pass to the tween_to function. If you want to do the oposite (from one value you pass, to the current variables values), you can use tween_from:

x = 200;
tween_from(id, 2, ["x", 100]); // Will tween from the passed value (x=100) to the actual value (x=200)

Also, you can use tween_fromto to define the starting and ending values:

tween_fromto(id, 2, ["x", 100], ["x", 200, "angle", 90]); //from x=100 to x=200 and image_angle=90

The VARS array

The array you are passing to the tween_to, tween_from and tween_fromto is called VARS array. You will find references to this array across all the documentation. You can pass special VARS in this array. to control the behavior of the animation itself. For example:

tween_to(id, 2, ["alpha", 100, "ease", ease_elastincin, "patrol", true]);

Here, the "ease" and "patrol" are special VARS. The ease define the animation curve used to interpolate the values, and patrol means that the animation will repeat forever forwards and backwards. You can check all the special VARS you can use inside the Animation folder of this documentation.

Tweenlines vs Tweens

If you want to control multiple tweens at the same time with advanced timing functionality, you can create a "Tweenline". A Tweenline is like timeline for Tweens. You can have inside any number of tweens or another nested tweenlines. They can be sequantial, overlaped, or however you want. Your creativity is your limit!

Check the Tweenline folder for more info and examples.


Both Tweens and Tweenlines ARE Animations. It means that you can pass a instance of a tweenline, or a Tween to any anim_* function.

Below there is a description of the content of each Documentation Folder.


For questions/Bugs/support or to show me the game you are making with Tweenline Animation Engine, please send me an email: