tween_stagger_fromto

Syntax:

tween_stagger_fromto(targets_array, duration, from_vars, to_vars, stagger, [wave_amount]);
Argument name Type Description
targets_array Array of instances or objects The target instances to tween
duration real The duration in seconds or frames (for frames based tweens)
from_vars Array The special vars array. For more info about the vars array see the Animation documentation.
to_vars Array The special vars array. For more info about the vars array see the Animation documentation.
stagger real Amount of time to stagger the start time of each tween.
wave_amount integer How many instances will grouped in one "wave"

Returns: (Array of Tweens) Array with the tweens that has been created

Description:

Tweens an array of targets from and to a common set of destination values, but staggers their start times by a specified amount of time, creating an evenly-spaced sequence with a surprisingly small amount of code.

The parameter stagger is the amount of time in seconds (or frames if the timeline is frames-based) to stagger the start time of each tween.

wave_amount (optional) indicates how many instances will grouped in one "wave". For example, if you want to animate 30 obj_box instances placed one after another in a 6 rows and 5 columns, and you want to generate 5 staggers of 6 instances (one stagger for each column), you neeed to pass 6 as the value of wave_amount. The default is 1, meaning that each instance will be staggered.

Returns an array of the indexes of the tweens that has been created

Example:

tweens_array = tween_stagger_from([obj_box1, obj_box2, obj_box3], 2.8, ["x", 20, "angle", 90], ["x", 800,"angle", 270, "ease", ease_backout],  0.4);