TweenGMS Reference v0.9.6
|
||
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
|
|
TweenDelayOnFinishAdd |
TweenDelayOnCancelAdd |
|
TweenDelayOnPauseAdd |
TweenDelayOnResumeAdd |
|
TweenDelayOn____Enable |
TweenDelayOn____Remove |
TweenDelayOn____Clear |
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
||
|
||
|
|
|
Returns the eased interpolation of two input values by the given amount.
Ease(value1,value2,amount,ease)
value1 |
Starting value |
value2 |
Destination value |
amount |
Amount to ease between start and destination (0.0 - 1.0) |
ease |
Easing algorithm script |
Returns: real
Example:
// Using EaseInCubic, ease value between 0 and 100 with amount of 0.75 value = Ease(0, 100, 0.75, EaseInCubic);
Prepares an extended property setter by specifying the extended script and the data it will receive. A value is returned which is to be used as the property setter for future tween script calls.
NOTE: Extended property setter scripts cannot be used directly like regular property setters. More information can be found inside the script Default_Property_Setters_Ext.
TPSetExt(ext_property,arg0,arg1,...)
ext_property |
Extended property setter script index |
arg0... |
Values to pass to extended property script |
Returns: extended property setter
Example:
// Create extended property setter property_xy = TPSetExt(ext_xy__, x, mouse_x, y, mouse_y); // Play tween using extended property setter TweenFire(id, property_xy, true, EaseInQuad, 0.0, 1.0, 5.0);
Creates a tween and returns its unique id. Arguments in [square] brackets are optional for fully defining tween at creation.
Tweens are automatically destroyed when the target instance is destroyed. Tweens can be manually destroyed by using TweenDestroy().
TweenCreate(target,property,delta[,ease,start,dest,dur])
target |
Instance to use tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Easing algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Create partially defined tween with 'x' property tween_partial = TweenCreate(id, x__, true); // Create fully defined tween with 'y' property tween_full = TweenCreate(id, y__, true, EaseLinear, x, mouse_x, 10); // Create tween, passing a single index array as its property myProperty[0] = 0; tween_array = TweenCreate(id, myProperty, true);
Defines the parameters of an existing tween.
TweenDefine(tween,target,property,delta,ease,start,dest,dur)
tween |
Tween id |
target |
Instance to use tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Easing algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create fully defined tween tween = TweenCreate(id, x__, true, EaseLinear, x, mouse_x, 10); // Redefine tween TweenDefine(tween, other, y__, true, EaseOutQuad, 0, 100, 5); // Play defined tween TweenPlayOnce(tween);
Returns a copy of an existing tween. NOTE: Delays and event callbacks will not be copied.
TweenCopy(tween,target)
tween |
Tween id |
target |
Instance to use tween |
Returns: tween id
Example:
// Create tween tween = TweenCreate(id, x__, true, EaseLinear, x, mouse_x, 10); // Make copy of previously created tween tweenCopy = TweenCopy(tween, other);
Manually destroys specified tween. NOTE: TweenGMS will automatically destroy tweens if associated target instance is destroyed
TweenDestroy(tween)
tween |
Tween id |
Returns: na
Example:
// Create tween tween = TweenCreate(id, y__, false); // Manually destroy tween TweenDestroy(tween);
Returns true if a specified tween exists.
TweenExists(tween)
tween |
Tween id |
Returns: boolean
Example:
// Play tween if it exists if (TweenExists(tween)) { TweenPlayOnce(tween); }
Returns a null tween which can be safely called by any tween function.
TweenNull()
Returns: null tween id
Example:
// Destroy previously created tween TweenDestroy(tween); // Nullify destroyed tween handle tween = TweenNull(); // Will not cause error TweenPlayOnce(tween);
Indicates if a tween should be destroyed when it is finished or stopped, and after all delays have been executed. Optionally, the target can be destroyed.
Note: TweenFire*() tweens are automatically destroyed by default.
TweenDestroyWhenDone(tween,destroy,[kill_target])
tween |
Tween id |
destroy |
Destroy tween? |
kill_target |
Destroy target as well? |
Returns: na
Example:
// Create a new tween tween = TweenCreate(id, x__, true); // Tell tween to destroy itself (and its target) when done TweenDestroyWhenDone(tween, true, true);
Plays previously created tween one time. Arguments in [square] brackets are optional if tween fully defined.
TweenPlayOnce(tween[,ease,start,dest,dur])
tween |
Tween id |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create a partially defined tween tween1 = TweenCreate(id, x__, true); // Define and play previously created tween TweenPlayOnce(tween1, EaseInQuad, 50, 100, 30); // Create a fully defined tween, passing an array as the property propValue[0] = 0; tween2 = TweenCreate(id, propValue, true, EaseLinear, 0, 100, 10); // Play fully defined tween TweenPlayOnce(tween2);
Plays previously created tween which bounces back to start. Arguments in [square] brackets are optional if tween fully defined.
TweenPlayBounce(tween[,ease,start,dest,dur])
tween |
Tween id |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, image_angle__, true); // Play previously created tween with BOUNCE mode TweenPlayBounce(tween, EaseInOutQuart, 0, 360, 2);
Plays previously created tween, bouncing endlessly between start and finish. Arguments in [square] brackets are optional if tween fully defined.
TweenPlayPatrol(tween,[ease,start,dest,dur])
tween |
Tween id |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, direction__, true); // Play previously created tween with PATROL mode TweenPlayPatrol(tween, EaseInOutQuart, 0, 360, 2);
Plays previously created tween, looping endlessly between start and finish. Arguments in [square] brackets are optional if tween fully defined.
TweenPlayLoop(tween[,ease,start,dest,dur])
tween |
Tween id |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, direction__, true); // Play previously created tween with LOOP mode TweenPlayLoop(tween, EaseInOutQuart, 0, 360, 2);
Plays previously created tween, repeating endlessly. Arguments in [square] brackets are optional if tween fully defined.
TweenPlayRepeat(tween[,ease,start,dest,dur])
tween |
Tween id |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, direction__, true); // Play previously created tween with REPEAT mode TweenPlayRepeat(tween, EaseInOutQuart, 0, 360, 2);
Extends TweenPlay____() functions with extra argument to delay start of tween. A unique id is returned which can be used with TweenDelay* scripts. Arguments in [square] brackets are optional if tween is fully defined.
TweenPlay____Delay(tween,delay[,ease,start,dest,dur])
tween |
Tween id |
delay |
Time to delay start in steps or seconds |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: delay id
Example:
// Create new tween tween = TweenCreate(id, x__, false); // Have tween play after set duration of time delay = TweenPlayOnceDelay(tween_x, 300, EaseInSine 0, 32, 30);
Creates and plays a tween which is automatically destroyed when finished or stopped. A unique tween id is returned.
TweenFire(target,property,delta,ease,start,dest,dur)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Play tween and store its returned id tween = TweenFire(id, x__, true, EaseLinear, 0, 100, 5);
Creates and plays a tween which bounces back to start after reaching destination. Automatically destroyed when finished or stopped.
TweenFireBounce(target,property,delta,ease,start,dest,dur)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seonds) or step timing |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Play tween with BOUNCE mode and store returned id tween = TweenFireBounce(id, x__, true, EaseLinear, 0, 100, 5);
Creates and plays a tween which patrols between two points. Automatically destroyed when finished or stopped.
TweenFirePatrol(target,property,delta,ease,start,dest,dur)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Play tween with PATROL mode and store returned id tween = TweenFirePatrol(id, x__, true, EaseInOutQuad, 0, room_width, 5);
Creates and plays a tween which loops between start/destination values. Automatically destroyed when stopped.
TweenFireLoop(target,property,delta,ease,start,dest,dur)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Play tween with LOOP mode and store returned id tween = TweenFireLoop(id, x__, true, EaseInOutQuad, 0, room_width, 5);
Creates and plays a tween which repeats from its relative position. Automatically destroyed when stopped.
TweenFireRepeat(target,property,delta,ease,start,dest,dur)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Ease algorithm script |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
Returns: tween id
Example:
// Play tween with REPEAT mode and store returned id tween = TweenFireRepeat(id, x__, true, EaseInOutQuad, 0, sprite_width, 5);
Extends TweenFire*() scripts to play after a set amount of time. Returns array holding newly created tween and delay ids.
TweenFire____Delay(target,property,delta,ease,start,dest,dur,delay)
target |
Instance to play tween |
property |
Variable to ease using property setter or array |
delta |
Choose between using delta(seconds) or step timing |
ease |
Ease algorithm script id |
start |
Starting value |
dest |
Destination value |
dur |
Duration of tween in steps or seconds |
delay |
Time to delay tween in seconds or steps |
Returns: array [0: tween_id | 1: delay_id]
Example:
// Fire tween and store its [tween | delay] id array ids = TweenFireDelay(id, x__, true, EaseLinear, 0, 100, 5); // Get tween and delay handles from returned array tween = ids[0]; delay = ids[1];
Eases target instance along indicated path from start to finish.
TweenPathFire(target,path,absolute,delta,dur,ease)
target |
Instance to have path tweened |
path |
Path resource index |
absolute |
Follow absolute path or relative? |
delta |
Choose between using delta(seconds) or step timing |
dur |
Tween duration in steps or seconds |
ease |
Ease algorithm |
Returns: tween id
Example:
// Tween absolute path “path_1” over 120 steps TweenFirePath(id, path_1, true, false, 120, EaseInOutSine);
Eases target along indicated path, bouncing back to start after reaching destination
TweenPathFireBounce(target,path,absolute,delta,dur,ease)
target |
Instance to have path tweened |
path |
Path resource index |
absolute |
Follow absolute path or relative? |
delta |
Use seconds timing? |
dur |
Tween duration in steps or seconds |
ease |
Ease algorithm |
Returns: tween id
Example:
// Tween absolute path “path_1” over 120 steps using BOUNCE mode TweenFirePathBounce(id, path_1, true, false, 120, EaseInOutSine);
Eases target along indicated path, bouncing endlessly between start/destination
TweenPathFirePatrol(target,path,absolute,delta,dur,ease)
target |
Instance to have path tweened |
path |
Path resource index |
absolute |
Follow absolute path or relative? |
delta |
Use seconds timing? |
dur |
Tween duration in steps or seconds |
ease |
Ease algorithm |
Returns: tween id
Example:
// Tween absolute path “path_1” over 120 steps using PATROL mode TweenFirePathPatrol(id, path_1, true, false, 120, EaseInOutSine);
Eases target along indicated path, looping endlessly between start/destination
TweenPathFireLoop(target,path,absolute,delta,dur,ease)
target |
Instance to have path tweened |
path |
Path resource index |
absolute |
Follow absolute path or relative? |
delta |
Use seconds timing? |
dur |
Tween duration in steps or seconds |
ease |
Ease algorithm |
Returns: tween id
Example:
// Tween absolute path “path_1” over 120 steps using LOOP mode TweenFirePathPatrol(id, path_1, true, false, 120, EaseInOutSine);
Eases target along indicated path, repeating from relative position when reaching destination
TweenPathFireRepeat(target,path,absolute,delta,dur,ease)
target |
Instance to have path tweened |
path |
Path resource index |
absolute |
Follow absolute path or relative? |
delta |
Use seconds timing? |
dur |
Tween duration in steps or seconds |
ease |
Ease algorithm |
Returns: tween id
Example:
// Tween absolute path “path_1” over 120 steps using REPEAT mode TweenFirePathPatrol(id, path_1, true, false, 120, EaseInOutSine);
Stops specified tween.
TweenStop(tween)
tween |
Tween id |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, x__, false); // Play tween TweenPlayOnce(tween, EaseLinear, 0, 32, 30); // Stop tween TweenStop(tween);
Pauses a specified tween.
TweenPause(tween)
tween |
Tween id |
Returns: na
Example:
// Create new tween tween = TweenCreate(id, x__, false); // Play tween TweenPlayOnce(tween, EaseOutBounce, 0, 32, 30); // Pause tween TweenPause(tween);
Resumes specified tween.
TweenResume(tween)
tween |
Tween id |
Returns: na
Example:
// Create tween tween = TweenCreate(id, x__, false); // Play tween TweenPlayOnce(tween, EaseInCubic, 0, 32, 30); // Pause tween TweenPause(tween); // Resume tween TweenResume(tween);
Reverses play direction of specified tween.
TweenReverse(tween)
tween |
Tween id |
Returns: na
Example:
// Create tween tween = TweenCreate(id, x__, false); // Play looping tween TweenPlayLoop(tween, EaseOutQuad, 0, 32, 30); // Reverse tween direction TweenReverse(tween);
Has tween immediately finish and optionally execute event callback. NOTE: Only works for TweenPlayOnce, TweenPlayBounce, TweenFire, TweenFireBounce.
TweenFinish(tween,call_event)
tween |
Tween id |
call_event |
Execute finish event callbacks? |
Returns: na
Example:
// Have tween immediately finish and not execute callback TweenFinish(tween,false);
Manually updates tween one step forward.
TweenStepNext(tween)
tween |
Tween id |
Returns: na
Example:
// Pause tween TweenPause(tween); // Step tween forward TweenStepNext(tween);
Manually updates tween one step backward.
TweenStepPrevious(tween)
tween |
Tween id |
Returns: na
Example:
// Pause tween TweenPause(tween); // Step tween back TweenStepPrevious(tween);
Calls tween script with all tweens belonging to a specified target.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
Tween____Target(deactivated, ...)
deactivataed |
Affect tweens belonging to deactivated targets? |
... |
Original script parameters |
Returns: na
Example:
// Pause all tweens, including ones belonging to deactivated targets TweenPauseAll(true);
Calls tween script with all tweens. Extra argument to indicate if you want to affect tweens belonging to deactivated targets.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
Tween____All(deactivated, ...)
deactivated |
Affect tweens belonging to deactivated targets? |
... |
Original script parameters |
Returns: na
Example:
// Pause all tweens, including ones belonging to deactivated targets TweenPauseAll(true);
Calls tween script with all tweens of specified control group. Extra argument to indicate if you want to affect tweens belonging to deactivated targets.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
Tween____Group(group,deactivated, ...)
group |
Tween control group |
deactivated |
Affect tweens belonging to deactivated targets? |
... |
Original script parameters |
Returns: na
Example:
// Pause all tweens of group 2, not including ones belonging to deactivated targets TweenPauseGroup(2, false);
Returns eased value based on tween's current state. NOTE: Setting a tween's property as an empty string “” will prevent ease from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().
TweenCalc(tween)
tween |
Tween id |
Returns: real
Example:
// Create a new tween with null property setter “” string tween = TweenCreate(id, “”, true, EaseLinear, 0, 100, 10); // Adjust tween's time TweenSetTime(tween, 5); // Get calculated value of tween's current state value = TweenCalc(tween);
Returns tween's calculated ease value by the given amount. NOTE: Setting a tween's property as an empty string “” will prevent ease from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().
TweenCalcAmount(tween,amount)
tween |
Tween id |
amount |
Amount to ease (0.0 - 1.0) |
Returns: real
Example:
// Create a new tween with null property setter “” string tween = TweenCreate(id, “”, true, EaseLinear, 0, 100, 10); // Get calculated value of tween at 50% value = TweenCalcAmount(tween, 0.5);
Returns tween's calculated ease value based on the given time in seconds or steps. NOTE: Setting a tween's property as an empty string “” will prevent ease from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().
TweenCalcTime(tween,time)
tween |
Tween id |
time |
Tween time in seconds or steps |
Returns: real
Example:
// Create a new tween with null property setter “” string tween = TweenCreate(id, “”, true, EaseLinear, 0, 100, 10); // Get calculated value of tween at 5 seconds value = TweenCalcTime(tween, 5);
Checks if tween state is playing.
TweenIsActive(tween)
tween |
Tween id |
Returns: boolean
Example:
// Play tween if it isn't already if (TweenIsPlaying(tween) == false) { TweenPlayOnce(tween); }
Checks if tween state is stopped.
TweenIsStopped(tween)
tween |
Tween id |
Returns: boolean
Example:
// Play tween if it is stopped if (TweenIsStopped(tween)) { TweenPlayOnce(tween); }
Checks if tween state is paused.
TweenIsPaused(tween)
tween |
Tween id |
Returns: boolean
Example:
// Resume tween if it is paused if (TweenIsPaused(tween)) { TweenResume(tween); }
Sets following simple tween calls to use delta(seconds) or step timing. Default = step based.
TweenSimpleUseDelta(delta)
delta |
Use delta(seconds) timing? |
Returns: na
Example:
// Uses default step timing TweenSimpleMove(x, y, mouse_x, mouse_y, 50, EaseOutQuint); // Set simple tweens to use seconds timing TweenSimpleUseDelta(true); // Uses delta(seconds) timing TweenSimpleRotate(0, 360, 2.0, EaseInOutSine);
Eases an instance between two positions.
TweenSimpleMove(x1,y1,x2,y2,dur,ease)
x1 |
x start |
y1 |
y start |
x2 |
x destination |
y2 |
y destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Move instance to mouse location tween = TweenSimpleMove(x, y, mouse_x, mouse_y, 30, EaseInQuart);
Eases an instance between two positions. The x/y values are rounded to whole numbers.
TweenSimpleMoveInt(x1,y1,x2,y2,dur,ease)
x1 |
Position x start |
y1 |
Position y start |
x2 |
Position x destination |
y2 |
Position y destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Move instance to mouse location tween = TweenSimpleMoveInt(x, y, mouse_x, mouse_y, 30, EaseInQuart);
Eases the image alpha of an instance between two values.
TweenSimpleFade(alpha1,alpha2,duration,ease)
alpha1 |
Alpha start |
alpha2 |
Alpha destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Fade in instance over 30 steps tween = TweenSimpleFade(0.0, 1.0, 30, EaseInOutCubic);
Eases the image angle of an instance between two values.
TweenSimpleRotate(angle1,angle2,dur,ease)
angle1 |
Image angle start |
angle2 |
Image angle destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Rotate instance one full rotation over 30 steps tween = TweenSimpleRotate(0, 360, 30, EaseOutQuad);
Eases the image xscale and image yscale of an instance between two values.
TweenSimpleScale(xscale1,yscale1,xscale2,yscale2,dur,ease)
xscale1 |
Image scale x start |
yscale1 |
Image scale y start |
xscale2 |
Image scale x destination |
yscale2 |
Image scale y destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Scale instance to half size over 30 steps tween = TweenSimpleScale(1.0, 1.0, 0.5, 0.5, 30, EaseInQuad);
Eases image_index of instance between two values.
TweenSimpleCycleImages(index1,index2,dur,ease)
index1 |
Image index start |
index2 |
Image index destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Play through an instance's sprite images over 100 steps tween = TweenSimpleCycleImages(0, image_number-1, 100, EaseInSine);
Eases an instances image_blend value between two colours
TweenSimpleColour(col1,col2,dur,ease)
col1 |
Starting image blend colour |
col2 |
Destination image blend colour |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Change instance's image_blend from white to red over 30 steps tween = TweenSimpleColour(c_white, c_red, 30, EaseInSine);
Eases the speed of an instance between two values.
TweenSimpleSpeedRamp(speed1,speed2,dur,ease)
speed1 |
Speed start |
speed2 |
Speed destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Double an instance's speed over 60 steps tween = TweenSimpleSpeedRamp(speed, speed*2, 60, EaseOutCubic);
Eases the hspeed and vspeed of an instance between two values.
TweenSimpleHVSpeedRamp(hspeed1,vspeed1,hspeed2,vspeed2,dur,ease)
hspeed1 |
Horizontal speed start |
vpseed1 |
Vertical speed start |
hspeed2 |
Horizontal speed destination |
vspeed2 |
Vertical speed destination |
dur |
Duration of tween in steps or seconds |
ease |
Easing algorithm script |
Returns: tween id
Example:
// Ease hspeed and vspeed to 25% and 50% over 20 steps tween = TweenSimpleHVSpeedRamp(hspeed, vspeed, 0.25, 0.5, 20, EaseOutQuint);
Extends the default TweenSimple____ scripts to take a delay.
TweenSimple____Delay(...,delay)
Returns: array [0: tween_id | 1:delay_id]
Example:
// Play delayed simple tween and store its tween/delay id handles ids = TweenSimpleMoveDelay(x, y, mouse_x, mouse_y, 30, EaseLinear, 100); // Get stored id handles tween_id = ids[0]; delay_id = ids[1];
Adds a callback(script) to be executed when a tween starts playing. Multiple callbacks can be added to a single event.
TweenOnPlayAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Playing!” message when tween starts to play callback = TweenOnPlayAdd(tween, id, ShowMessage, “Playing!”);
Adds a callback(script) to be executed when a tween finishes. Multiple callbacks can be added to a single event.
TweenOnFinishAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Finished!” message when tween finishes callback = TweenOnFinishAdd(tween, id, ShowMessage, “Finished!”);
Adds a callback(script) to be executed when a tween is stopped. Multiple callbacks can be added to a single event.
TweenOnStopAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Stopped!” message when tween finishes callback = TweenOnStopAdd(tween, id, ShowMessage, “Stopped!”);
Adds a callback(script) to be executed when a tween is paused. Multiple callbacks can be added to a single event.
TweenOnPauseAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Paused!” message when tween finishes callback = TweenOnPauseAdd(tween, id, ShowMessage, “Paused!”);
Adds a callback(script) to be executed when a tween is resumed. Multiple callbacks can be added to a single event.
TweenOnResumeAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Resumed!” message when tween finishes callback = TweenOnResumeAdd(tween, id, ShowMessage, “Resumed!”);
Adds a callback(script) to be executed when a tween loops. Multiple callbacks can be added to a single event.
TweenOnLoopAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Looping!” message when tween finishes callback = TweenOnLoopAdd(tween, id, ShowMessage, “Looping!”);
Adds a callback(script) to be executed when a tween repeats. Multiple callbacks can be added to a single event.
TweenOnRepeatAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Repeating!” message when tween finishes callback = TweenOnRepeatAdd(tween, id, ShowMessage, “Repeating!”);
Adds a callback(script) to be executed when a tween bounces. Multiple callbacks can be added to a single event.
TweenOnBounceAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Bounced!” message when tween finishes callback = TweenOnBounceAdd(tween, id, ShowMessage, “Bounced!”);
Adds a callback(script) to be executed when a tween is reversed. Multiple callbacks can be added to a single event.
TweenOnReverseAdd(tween,target,script[,arg0,arg1,...])
tween |
Tween id |
target |
Instance to call script |
script |
Script index |
arg0... |
Optional arguments to pass to script |
Returns: callback id
Example:
// Create tween tween = TweenCreate(id, x__, false); // Show “Reversing!” message when tween finishes callback = TweenOnReverseAdd(tween, id, ShowMessage, “Reversing!”);
Removes a callback from a specified tween event.
TweenOn____Remove(tween,callback)
tween |
Tween id |
callback |
Callback id |
Returns: boolean
Example:
tween = TweenCreate(id, x__, false); callback = TweenOnPlayAdd(tween, id, ShowMessage, “Playing!”); TweenOnPlayRemove(tween, callback);
Removes all callbacks from a specified tween event.
TweenOn____Clear(tween)
tween |
Tween id |
Returns: na
Example:
tween = TweenCreate(id, x__, false); TweenOnPlayAdd(tween, id, ShowFireworks); TweenOnPlayAdd(tween, id, AddNumbers, 4, 15); TweenOnPlayRemoveAll(tween);
Enables execution of callbacks for tween's specified event.
TweenOn____Enable(tween,enable)
tween |
Tween id |
enable |
Enable event? |
Returns: na
Example:
TweenOnStopEnable(tween, false); TweenStop(tween);
Enables execution of callbacks for specified event for tween group.
TweenOn____EnableGroup(group,deactivated,enable)
group |
Tween group |
deactivated |
Affect tweens belonging to deactivated targets? |
enable |
Enable event? |
Returns: na
Example:
TweenOnPlayEnableGroup(2, true, false);
Enables execution of callbacks for specified event with all tweens
TweenOn____EnableAll(deactivated,enable)
deactivated |
Affect tweens belonging to deactivated targets? |
enable |
Enable event? |
Returns: na
Example:
TweenOnPlayEnableAll(false, true);
Enables execution of callbacks for specified event for tween group.
TweenOn____EnableTarget(target,enable)
target |
Instance id |
enable |
Enable event? |
Returns: na
Example:
TweenOnPlayEnableTarget(obj_Player.id, true);
Returns true if the specified callback exists.
TweenCallbackExists(tween)
callback |
Callback id |
Returns: boolean
Example:
if (TweenCallbackExists(cb_message)) { TweenOnFinishRemove(cb_message); }
Returns a null callback which can be safely called later.
TweenCallbackNull()
Returns: null callback id
Example:
// Nullify callback handle cb = TweenCallbackNull(); // Does not cause error TweenOnFinishRemove(cb)
Returns a null delay id.
TweenDelayNull()
Returns: null delay id
Example:
delay = TweenPlayOnceDelay(tween, x__, x, mouse_x, 30, EaseInQuad, 100); delay = TweenDelayNull();
Calls indicated delay script with all delays. Extra argument to indicate if you want to affect tween delays associated with deactivated targets.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
TweenDelay____All(deactivated, ...)
deactivataed |
Affect tweens belonging to deactivated targets? |
... |
Original script parameters |
Returns: na
Example:
TweenDelayPauseAll(false);
Calls indicated delay script with all tween delays associated with group. Extra argument to indicate if you want to affect tween delays associated with deactivated targets.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
TweenDelay____Group(group,deactivated, ...)
group |
Tween control group |
deactivated |
Affect tweens belonging to deactivated targets? |
... |
Original script parameters |
Returns: na
Example:
TweenDelayResumeAll(2, false);
Calls indicated delay script with all tween delays associated with target.
Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.
TweenDelay____Target(...)
... |
Original script parameters |
Returns: na
Example:
TweenDelayCancelTarget(id);
Cancels a delayed tween timer. NOTE: Supplying only the tween id will cancel all delays associated with it.
TweenDelayCancel(tween[,delay])
tween |
Tween id |
delay |
Delay id |
Returns: na
Example:
delay = TweenPlayOnceDelay(tween, 50, EaseLinear, x, mouse_x, 30); TweenDelayCancel(delay);
Pauses a delayed tween timer. NOTE: Supplying only the tween id will pause all delays associated with it.
TweenDelayPause(tween[,delay])
tween |
Tween id |
delay |
Delay id |
Returns: na
Example:
delay = TweenPlayOnceDelay(tween, 100, EaseInQuad, x, mouse_x, 30); TweenDelayPause(delay);
Resumes a paused tween delay. NOTE: Supplying only the tween id will resume all delays associated with it.
TweenDelayResume(tween[,delay])
tween |
Tween id |
delay |
Delay id |
Returns: na
Example:
delay = TweenPlayOnceDelay(tween, 100, EaseInQuad, x, mouse_x, 30); TweenDelayPause(delay); TweenDelayResume(delay);
Has a delay immediately finish and start associated tween. NOTE: Supplying only the tween id will finish all delays associated with it.
TweenDelayFinish(tween[,delay])
tween |
Tween id |
delay |
Optional delay id |
Returns: na
Example:
// Finish all delays associated with tween TweenDelayFinish(tween);
Returns the remaining time left in a delay
TweenDelayGetTime(delay)
delay |
Delay id |
Returns: real
Example:
timeLeft = TweenDelayGetTime(delay);
Changes the timer value
TweenDelaySetTime(delay,time)
delay |
Delay id |
time |
New timer value |
Returns: na
Example:
TweenDelaySetTime(delay, 10.0);
Returns true if the specified tween delay exists
TweenDelayExists(delay)
delay |
Delay id |
Returns: boolean
Example:
if (TweenDelayExists(delay_message)) { TweenDelayCancel(delay_message); }
Tells a tween delay to update the property setter when tween starts to play. Can be useful when using TweenPlay____Delay scripts. Typically, this is not required when using TweenFire____Delay and TweenSimple____Delay scripts.
TweenDelayPropertySetter(delay, property)
delay |
Delay id |
property |
Property setter |
Returns: na
Example:
// Create two different extended property setters pExt1 = TPSetExt(ext_xy__, 0, 100, 0, 100); pExt2 = TPSetExt(ext_xy__, 100, 0, 100, 0); // Create and play a tween using the first property setter tween = TweenCreate(id, pExt1, true); TweenPlayOnce(id, EaseInQuad, 0, 1, 3.0); // Delay the tween and tell it to activate the second property when the tween starts playing var _delay = TweenPlayOnceDelay(tween, 3.0, EaseOutQuad, 0, 1, 3.0); TweenDelayPropertySetter(_delay, pExt2);
Activates obj_SharedTweener singleton if by chance it is deactivated. Be careful when using instance_deactivate_*** scripts.
SharedTweenerActivate()
Returns: na
Example:
instance_deactivate_all(true); SharedTweenerActivate();
Destroys obj_SharedTweener singleton, effectively clearing entire tweening system.
SharedTweenerDestroy()
Returns: na
Example:
SharedTweenerDestroy();
Returns state of tweening system
TweenSystemIsActive()
Returns: boolean
Example:
isEnabled = TweenSystemGetEnabled();
Sets state of tweening system
TweenSystemSetEnabled(enabled)
enabled |
Tweening system is enabled? |
Returns: na
Example:
TweenSystemSetEnabled(false);
Returns tweening system's update interval. Default = 1.
TweenSystemGetUpdateInterval()
Returns: real
Example:
updateInterval = TweenSystemGetUpdateInterval();
Sets shared tweening systems update interval.
TweenSystemSetUpdateInterval(interval)
interval |
How often, in steps, to update tween system. (Default = 1) |
Returns: na
Returns: na
Example:
// Update tween system every 2 steps TweenSystemSetUpdateInterval(2);
Returns the current time scale of the entire tweening system
TweenSystemGetTimeScale()
Returns: real
Example:
timescale = TweenSystemGetTimeScale();
Sets the time scale for the entire tweening system
TweenSystemSetTimeScale(scale)
scale |
Tweening system's time scale (default = 1.0) |
Returns: na
Example:
// Have system update tweens 2x faster TweenSystemSetTimeScale(2.0);
Overrides passive memory manager by immediately cleaning all destroyed tweens from system.
TweenSystemFlushDestroyed()
Returns: na
Example:
TweenSystemFlushDestroyed();
Sets the minimum frame rate in which case delta timing will lag behind step updates. (default = 10)
TweenSystemSetMinDeltaFPS(fps)
fps |
Frames(steps) per second |
Returns: na
Example:
// Delta updates lag behind if fps dips below 15 TweenSystemSetMinDeltaFPS(15);
TweenSystemSetAutoCleanIterations
Sets the max number of elements the passive memory system will check each step. (default = 10)
TweenSystemSetAutoCleanIterations(iterations)
iterations |
Number of tweens to check per step |
Returns: na
Example:
TweenSystemSetAutoCleanIterations(2);
Returns total number of tweens in system.
TweenSystemCount()
Returns: real
Example:
totalTweens = TweenSystemCount();
Returns total number of playing tweens in system. (slower than TweenSystemCount)
TweenSystemCountPlaying()
Returns: real
Example:
playingTweens = TweenSystemCountPlaying();
Returns total number of paused tweens in system. (slower than TweenSystemCount)
TweenSystemCountPaused()
Returns: real
Example:
pausedTweens = TweenSystemCountPaused();
Returns total number of stopped tweens in system. (slower than TweenSystemCount)
TweenSystemCountStopped()
Returns: real
Example:
stoppedTweens = TweenSystemCountStopped();
Returns the delta time value used by the tweening system.
TweenSystemDeltaTime(scaled)
scaled |
Get delta time affected by system time scale? |
Returns: na
Example:
dt = TweenSystemDeltaTime(false);
Sets the time scale of a single tween
TweenSetTimeScale(tween,scale)
tween |
Tween id |
scale |
Tween time scale |
Returns: na
Example:
tween = TweenCreate(id, x__, false); TweenSetTimeScale(tween, 0.5);
Sets the default time scale for newly created tweens
TweenDefaultSetTimeScale(scale)
scale |
Time scale |
Returns: na
Example:
TweenDefaultSetTimeScale(2.0);
Returns the default time scale for newly created tweens
TweenDefaultGetTimeScale()
Returns: real
Example:
defaultScale = TweenDefaultGetTimeScale();
Sets the default control group for newly created tweens
TweenDefaultSetGroup(group)
group |
Tween control group |
Returns: na
Example:
group_ui = 2; TweenDefaultSetGroup(group_ui);
Returns the default control group for newly created tweens
TweenDefaultGetGroup()
Returns: real
Example:
controlGroup = TweenDefaultGetGroup();
Clears tween data associated with a persistent room
TweenSystemClearRoom(room)
room |
Persistent room id |
Returns: na
Example:
TweenSystemClearRoom(room_next);
Clears tween data associated with all persistent rooms.
TweenSystemClearRoom()
Returns: na
Example:
TweenSystemClearAllRooms();
Designates tween to specified group.
TweenSetGroup(tween,group)
tween |
Tween id |
group |
Tween group |
Returns: na
Example:
tween = TweenCreate(id, x__, false); TweenSetGroup(tween, 2);
Sets the instance to be associated with specified tween
TweenSetTarget(tween,target)
tween |
Tween id |
target |
Instance affected by tween |
Returns: na
Example:
TweenSetTarget(tween, obj_Player);
Sets the property value to be tweened.
TweenSetProperty(tween,property)
tween |
Tween id |
property |
Value to ease (property script or array[0] id) |
Returns: na
Example:
TweenSetPropety(tween, direction__);
Changes start value of specified tween.
TweenSetStart(tween,start)
tween |
Tween id |
start |
New starting value |
Returns: na
Example:
TweenSetStart(tween, 0);
Changes destination of specified tween.
TweenSetDestination(tween,dest)
tween |
Tween id |
dest |
New destination value |
Returns: na
Example:
TweenSetDestination(tween, 0.5);
Changes duration of specified tween.
TweenSetDuration(tween,dur)
tween |
Tween id |
dur |
New duration for tween |
Returns: na
Example:
TweenSetDuration(tween, 120);
Changes ease algorithm of active tween
TweenSetEase(tween,ease)
tween |
Tween id |
ease |
Ease algorithm script id |
Returns: na
Example:
TweenSetEase(tween, EaseInOutCubic);
Sets time position of specified tween. Note that this might not work as expected with the BOUNCE and PATROL modes.
TweenSetTime(tween,time)
tween |
Tween id |
time |
New time value |
Returns: na
Example:
// Create a new tween tween = TweenCreate(id, x__, true); // Play tween TweenPlayOnce(tween, EaseInQuart, 0, 100, 5.0); // Jump tween's time halfway TweenSetTime(tween, 2.5);
Switches tween between delta and step based timing.
TweenSetDelta(tween,delta)
tween |
Tween id |
delta |
Use delta(seconds) timing? |
Returns: na
Example:
// Create tween which uses step timing tween = TweenCreate(id, x__, false); // Switch tween to use delta(seconds) timing instead TweenSetDelta(tween, true);
Changes play mode of specified tween.
TweenSetPlayMode(tween,mode)
tween |
Tween id |
mode |
Tween play mode constant (e.g. TWEEN_PLAY_ONCE) |
Returns: na
Example:
tween = TweenCreate(id, x__, false); TweenPlayPatrol(tween, EaseInOutCubic, 0, 640, 100); TweenSetPlayMode(tween, TWEEN_PLAY_ONCE);
Returns group which specified tween belongs to.
TweenGetGroup(tween)
tween |
Tween id |
Returns: na
Example:
tween = TweenCreate(id, y__, false);
TweenSetGroup(tween, 2);
group = TweenGetGroup(tween);
Returns the tween's target instance.
TweenGetTarget(tween)
tween |
Tween id |
Returns: instance id
Example:
target = TweenGetTarget(tween);
Returns the tween's eased property value. (Either a property setter script or a single index array id)
TweenGetProperty(tween)
tween |
Tween id |
Returns: script id OR array
Example:
property = TweenGetProperty(tween);
Returns the tween's starting value.
TweenGetStart(tween)
tween |
Tween id |
Returns: real
Example:
xStart = TweenGetStart(tween_x);
Returns the tween's destination value.
TweenGetDestination(tween)
tween |
Tween id |
Returns: real
Example:
xDest = TweenGetDestination(tween_x);
Returns the tween's total time in seconds or steps.
TweenGetDuration(tween)
tween |
Tween id |
Returns: real
Example:
timeDuration = TweenGetDuration(tween);
Returns the tween's easing algorithm script.
TweenGetEase(tween)
tween |
Tween id |
Returns: script id
Example:
easeType = TweenGetEase(tween);
Returns the tween's current elapsed time in seconds or steps.
TweenGetTime(tween)
tween |
Tween id |
Returns: real
Example:
elapsedTime = TweenGetTime(tween);
Returns whether or not a tween uses delta/seconds timing.
TweenGetDelta(tween)
tween |
Tween id |
Returns: boolean
Example:
isDelta = TweenGetUseSeconds(tween);
Returns the time scale of a single tween
TweenGetTimeScale(tween)
tween |
Tween id |
Returns: na
Example:
scale = TweenGetTimeScale(tween);
Returns the tween's play mode constant: TWEEN_PLAY_****
TweenGetPlayMode(tween)
tween |
Tween id |
Returns: real
Example:
playMode = TweenGetPlayMode(tween);
Returns the tween's state value. (1 = playing, 0 = paused, -1 = stopped, -2 = destroyed)
TweenGetState(tween)
tween |
Tween id |
Returns: real
Example:
state = TweenGetState(tween);
Returns the difference between the tween's start and destination values.
TweenGetChange(tween)
tween |
Tween id |
Returns: real
Example:
xChange = TweenGetChange(tween_x);
Returns a new tween iterator data array.
Tween can be accessed from first index of array -- iterator[0]
TweenIterator()
Returns: iterator
Example:
iterator = TweenIterator();
Takes tween iterator as parameter, iterating through tweens by using the 'while()' loop.
TweenIteratorNext(iterator)
iterator |
Previously created tween iterator |
Returns: bool
Example:
iterator = TweenIterator(); while(TweenIteratorNext(iterator)) { tween = iterator[0]; TweenPause(tween); }
Resets an iterator – use to manually clear an iterator before reusing.
Typically, iterators are automatically reset – use this to ensure it is.
TweenIteratorReset(iterator)
iterator |
Previously created tween iterator |
Returns: bool
Example:
TweenIteratorReset(iterator); while(TweenIteratorNext(iterator)) { tween = iterator[0]; TweenPause(tween); }