TweenGMS Script Reference
Version 0.9.70
      
   
-= Main =- 
TweenFire
TweenCreate TweenPlay TweenPlayDelay
TweenDestroy TweenDestroySafe TweenDestroyWhenDone
   
 -= State Booleans =- 
TweenExists TweenIsActive
TweenIsPlaying TweenIsPaused TweenIsStopped
   
-= State Modifiers =- 
Tween****All Tween****Group Tween****Target
TweenStop TweenPause TweenResume
TweenFinish TweenReverse TweenStep
TweenFinishDelay
   
-= Misc. Utility =- 
Ease
TweenNull TweenCopy TweenDefine
TweenDefault TweensExecute TPExt
TweenCalc TweenCalcAmount TweenCalcTime
   
-= Callbacks and Events =- 
TweenAddCallback TweenAddCallbackUser TweenCallbackNull
TweenCallbackInvalidate TweenCallbackIsValid
TweenCallbackEnable TweenCallbackIsEnabled
TweenEventClear TweenEventEnable TweenEventIsEnabled
   
-= Simple Tweens =- 
TweenSimpleUseDelta
TweenSimpleMove TweenSimpleScale TweenSimpleRotate
TweenSimpleMoveInt TweenSimpleFade TweenSimpleCycleImages
TweenSimpleColour TweenSimpleSpeedRamp TweenSimpleHVSpeedRamp
   
 -= Tween Setters =- 
TweenSetGroup TweenSetTimeScale TweenSetTime
TweenSetTarget TweenSetProperty TweenSetDelta
TweenSetStart TweenSetDestination TweenSetDuration
TweenSetDelay TweenSetDelayStart TweenSetMode
TweenSetEase TweenSetExtData
   
-= Tween Getters =- 
TweenGetGroup TweenGetTimeScale TweenGetTime
TweenGetTarget TweenGetProperty TweenGetDelta
TweenGetStart TweenGetDestination TweenGetDuration
TweenGetDelay TweenGetDelayStart TweenGetMode
TweenGetEase TweenGetExtData TweenGetState
TweenGetChange
   
 -= System Management =- 
TweenSystemGetEnabled TweenSystemGetTimeScale TweenSystemGetUpdateInterval
TweenSystemSetEnabled TweenSystemSetTimeScale TweenSystemSetUpdateInterval
TweenSystemSetMinDeltaFPS TweenSystemSetAutoCleanIterations TweenSystemDeltaTime
TweenSystemClearRoom TweenSystemClearAllRooms TweenSystemFlushDestroyed
TweenSystemCount TweenSystemCountPlaying TweenSystemCountPaused
TweenSystemCountStopped SharedTweenerActivate SharedTweenerDestroy
   
 *** TO BE DOCUMENTED *** 
TweenPath
   
TweenArray1D TweenArray2D
TweenDSList TweenDSGrid TweenDSMap
   
TweenViewPosition TweenViewX TweenViewY
TweenViewDimensions TweenViewWidth TweenViewHeight
TweenViewPortPosition TweenViewPortX TweenViewPortY
TweenViewAngle
   
TweenBackgroundPosition TweenBackgroundX TweenBackgroundY
TweenBackgroundScale TweenBackgroundScaleX TweenBackgroundScaleY
TweenBackgroundSpeed TweenBackgroundSpeedH TweenBackgroundSpeedV
TweenBackgroundColour TweenBackgroundAlpha TweenBackgroundBlend
   
TweenTilePosition TweenTileX TweenTileY
TweenTileScale TweenTileAlpha TweenTileBlend
TweenTileRegion TweenTileLayerShift


TweenFire
Creates and plays a tween which eases a property(variable) between two values over a set duration of time.
Tween is automatically destroyed when finished, stopped, or if its associated target is destroyed.
Returns unique tween id.

TweenFire(target,prop,ease,mode,delta,delay,dur,start,dest,...)
target Instance to associate with tween and its property
prop Property setter script (e.g. x__)
ease Ease algorithm script (e.g. EaseInOutQuad)
mode Play mode constant (0-4) (TWEEN_MODE_****)
delta Whether to set timing in seconds(true) or steps (false)
delay Amount of time to delay start of tween in seconds or steps
dur Duration of time to ease property from start to destination
start Starting value of eased property
dest Destination value of eased property
... (optional) Extra parameters for extended property setters
Returns: tween id

Example
// Tween x position from x to mouse_x over 30 steps
TweenFire(id, x__, EaseOutQuad, TWEEN_MODE_ONCE, false, 0, 30, x, mouse_x);

// Tween instance's image alpha back and forth from 0 to 1 over 2.0 seconds
TweenFire(id, image_alpha__, EaseInOutQuad, TWEEN_MODE_PATROL, true, 0.0, 2.0, 0, 1);

// Tween instance's image angle 360 degrees for 1 second after a 1.5 second delay
TweenFire(id, image_angle__, EaseInOutBack, TWEEN_MODE_ONCE, true, 1.5, 1.0, 0, 360);

// Tween instance's position to mouse position using extended property setter
TweenFire(id, ext_xy__, EaseOutElastic, 0, true, 0.0, 1.0, 0, 1, x, mouse_x, y, mouse_y);


TweenCreate
Creates a tween which exists until its target instance is destroyed or it is manually destroyed with TweenDestroy(). Tweens can be defined or undefined when created. Created tweens won't play until used with TweenPlay(). Returns unique tween id.

TweenCreate(target[,prop,easemode,delta,delay,dur,start,dest,...])
target Instance to associate with tween
prop Property setter script (e.g. x__)
ease Ease algorithm script (e.g. EaseInOutQuad)
mode Play mode constant (TWEEN_MODE_****)
delta Whether to set timing in seconds(true) or steps (false)
delay Amount of time to delay start of tween in seconds or steps
dur Duration of time to ease property from start to destination
start Starting value of eased property
dest Destination value of eased property
... (optional) Extra parameters for extended property setters

Returns: tween id

Example
// Create undefined tween
tween_undef = TweenCreate(id);
// Create defined tween
tween_def = TweenCreate(id, x__, EaseOutQuart, TWEEN_MODE_BOUNCE, true, 1.0, 5.0, x, mouse_x);	


TweenPlay
Plays a previously created tween. Arguments in [square] brackets are optional if tween is fully defined.

TweenPlay(tween[,property,ease,mode,delta,delay,dur,start,dest,...])
tween Tween id
prop Property setter script (e.g. x__)
ease Ease algorithm script (e.g. EaseInOutQuad)
mode Play mode constant (TWEEN_MODE_****)
delta Whether to set timing in seconds(true) or steps (false)
delay Amount of time to delay start of tween in seconds or steps
dur Duration of time to ease property from start to destination
start Starting value of eased property
dest Destination value of eased property
... (optional) Extra parameters for extended property setters

Returns: na

Example
// Create undefined tween
tween1 = Tweencreate(id);
// Define and play tween
TweenPlay(tween1, x__, EaseInElastic, TWEEN_MODE_PATROL, true, 0.0, 2.5, x, mouse_x);

// Create a defined tween
tween2 = TweenCreate(id, y__, EaseOutQuad, TWEEN_MODE_PATROL, true, 0.0, 2.5, y, mouse_y);
// Play defined tween
TweenPlay(tween2);	


TweenPlayDelay
Overrides a previously defined tween with a specified delay before playing.

TweenPlay(tween, delay)
tween Tween id
delay Amount of time to delay start of tween in seconds or steps

Returns: na

Example
// Create a defined tween
tween2 = TweenCreate(id, y__, EaseOutQuad, TWEEN_MODE_PATROL, true, 0.0, 2.5, y, mouse_y);
// Play defined tween after delay of 5.0 seconds
TweenPlayDelay(tween2, 5.0);


TweenDestroy
Manually destroys a specified tween.
NOTE: TweenGMS will automatically destroy tweens if associated target instance is destroyed

TweenDestroy(tween)
tween Tween id

Returns: null tween id

Example
// Create tween
tween = TweenCreate(id);

// Manually destroy tween
TweenDestroy(tween);


TweenDestroySafe
Destroys the indicated tween. No error will occur if tween isn't valid.

TweenDestroySafe(tween)
tween Tween id

Returns: null tween id

Example
// Get previous tween stored in handle
prevTween = tween;

// Fire new tween with 1.0 second delay
tween = TweenFire(id, image_alpha__, EaseOutQuart, 0, true, 1.0, 3.0, 0, 1);

// Tell new tween to destroy previous tween when it starts to play
TweenAddCallback(tween, TWEEN_EV_PLAY, id, TweenDestroySafe, prevTween;


TweenDestroyWhenDone
Indicates if a tween should be destroyed when it is finished or stopped, and after all delays have been executed. Optionally, the associated target can be set to be destroyed as well.
Note: TweenFire() tweens are automatically destroyed by default

TweenDestroyWhenDone(tween,destroy,[kill_target])
tween Tween id
destroy Destroy tween when finished?
kill_target Destroy target instance as well?

Returns: na

Example
// Create a new tween
tween = TweenCreate(id);

// Tell tween to destroy itself (and its target) when finished or stopped
TweenDestroyWhenDone(tween, true, true);


TweenExists
Returns true if a specified tween exists.

TweenExists(tween)
tween Tween id

Returns: bool

Example
// Play tween if it exists
if (TweenExists(tween))
{
    TweenPlay(tween);
}


TweenIsActive
Returns true if the specified tween is playing OR if it is actively processing a delay.

TweenIsActive(tween)
tween Tween id

Returns: bool

Example
// Play tween if it isn't already
if (TweenIsActive(tween))
{
    TweenPause(tween);
}


TweenIsPlaying
Checks if tween state is playing. Will NOT return true if tween is delayed.

TweenIsPlaying(tween)
tween Tween id

Returns: bool

Example
// Play tween if it isn't already
if (TweenIsPlaying(tween) == false)
{
    TweenPlay(tween);
}


TweenIsStopped
Returns true if specified tween is stopped.

TweenIsStopped(tween)
tween Tween id

Returns: bool

Example
// Play tween if it is stopped
if (TweenIsStopped(tween))
{
    TweenPlay(tween);
}


TweenIsPaused
Returns true if specified tween is paused.

TweenIsPaused(tween)
tween Tween id

Returns: bool

Example
// Resume tween if it is paused
if (TweenIsPaused(tween))
{
    TweenResume(tween);
}


Tween****All
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)
... Original script parameters
deactivated Affect tweens associated with deactivated targets?

Returns: na

Example
// Pause all tweens including those associated with deactivated targets
TweenPauseAll(true, true);


Tween****Group
Calls tween script with all tweens of specified control group. Extra argument to indicate if you want to affect tweens belonging to deactivated targets.

Tween****Group(group, ..., deactivated)
group Tween control group
... Original script parameters
deactivated Affect tweens associated with deactivated targets?

Returns: na

Example
// Pause all tweens of group 2, not including ones belonging to deactivated targets
TweenPauseGroup(2, false);


Tween****Target
Calls tween script with all tweens belonging to specified target. Target can be an instance id, object index, or parent. Any event callbacks with deactivated targets will not be executed. Tweens in dormant persistent rooms will not be affected.

Tween****Target(target, ..., deactivated)
target Instance id, object index, or parent
... Original script parameters
deactivated Affect tweens associated with deactivated targets?

Returns: na

Example
// Pause tweens associated with dude, except those belonging to deactivated targets
TweenPauseTarget(obj_Dude, false);


TweenStop
Stops a specified tween and executes any associated event callbacks.

TweenStop(tween)
tween Tween id

Returns: na

Example
// Fire tween
tween = TweenFire(id, x__, EaseLinear, TWEEN_MODE_LOOP, true, 0.0, 1.0, x, mouse_x);

// Stop tween
TweenStop(tween);


TweenPause
Pauses a specified tween and executes any associated event callbacks.

TweenPause(tween)
tween Tween id

Returns: na

Example
// Fire tween
tween = TweenFire(id, x__, EaseLinear, TWEEN_MODE_LOOP, true, 0.0, 1.0, x, mouse_x);

// Pause tween
TweenPause(tween);


TweenResume
Resumes a specified tween and executes any associated event callbacks.

TweenResume(tween)
tween Tween id

Returns: na

Example
// Fire tween
tween = TweenFire(id, x__, EaseLinear, TWEEN_MODE_LOOP, true, 0.0, 1.0, x, mouse_x);

// Pause tween
TweenPause(tween);
// Resume tween
TweenResume(tween);


TweenFinish
Finishes a specified tween and executes any associated event callbacks. Won't finish any delay. Please call TweenFinishDelay() first if needed.

TweenFinish(tween,call_event)
tween Tween id
call_event Execute FINISH event callback?

Returns: na

Example
// Have tween immediately finish and not execute callbacks
TweenFinish(tween,false);


TweenReverse
Reverses a specified tween and executes any associated event callbacks.

TweenReverse(tween)
tween Tween id

Returns: na

Example
// Fire tween
tween = TweenFire(id, x__, EaseLinear, TWEEN_MODE_LOOP, true, 0.0, 1.0, x, mouse_x);

// Reverse tween direction
TweenReverse(tween);


TweenStep
Manually updates tween in a relative direction by a given amount (1.0 | -1.0). A range of values can be given to step at varying scales/amounts. (0.5, 2.0, -0.25)

TweenStep(tween,amount)
tween Tween id
amount Relative direction/amount to step (1.0 = Next | -1.0 = Previous)

Returns: na

Example
// Step tween forward 1 step
TweenStep(tween, 1.0);

// Step tween forward 2 steps
TweenStep(tween, 2.0);

// Step tween back half a step
TweenStep(tween, -0.5);


TweenFinishDelay
Immediately starts to play a delayed tween.

TweenFinishDelay(tween,call_event)
tween Tween id
call_event Execute callbacks for FINISH DELAY event?

Returns: na

Example
// Have tween start to play immediately
TweenFinishDelay(tween,false);


Ease
Returns the interpolation of two values by a given amount using a specified ease algorithm.
Works similar to the lerp() function which returns a linear value.

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
// Ease value between 0 and 100 with amount of 0.75 using EaseInCubic
value = Ease(0, 100, 0.75, EaseInCubic);


TweenNull
Returns a null tween which can be safely called by any tween function.

TweenNull()
 

Returns: null tween id

Example
// Create null tween id
tween = TweenNull();

// Will not cause error
TweenPlay(tween);


TweenCopy
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 associate with tween

Returns: tween id

Example
// Create tween
tween = TweenCreate(id, x__, EaseInQuad, 0, true, 0.0, 3.0, x, mouse_x);

// Make copy of previously created tween
tweenCopy = TweenCopy(tween, other.id);


TweenDefine
Defines the parameters of an existing tween.

TweenDefine(tween,target,property,ease,mode,delta,delay,dur,start,dest,...)
tween Tween id
target Instance to associate with tween
prop Property setter script (e.g. x__)
ease Ease algorithm script (e.g. EaseInOutQuad)
mode Play mode constant (TWEEN_MODE_****)
delta Whether to set timing in seconds(true) or steps (false)
delay Amount of time to delay start of tween in seconds or steps
dur Duration of time to ease property from start to destination
start Starting value of eased property
dest Destination value of eased property
... (optional) Extra parameters for extended property setters

Returns: na

Example
// Create undefined tween
tween = TweenCreate(id);

// Define tween
TweenDefine(tween, other, y__, EaseInQuart, TWEEN_MODE_PATROL, true, 0.0, 1.0, 0, 100);

// Play defined tween
TweenPlay(tween);


TweenDefault
Returns id of default tween used as base for every new tween. This can be used to set the default group or time scale for new tweens.

TweenDefault()
   
Returns: default tween id

Example
// Have following tweens belong to group 2
TweenSetGroup(TweenDefault(), 2);
// Have following tweens run at half speed
TweenSetTimeScale(TweenDefault(), 0.5);

// Fire tween -- will belong to group 2 and run at half speed
TweenFire(id, x__, EaseInQuart, 0, true, 0.0, 1.0, x, mouse_x);


TweensExecute
Iterates through selected tweens and executes the specified script for each. Supported scripts must receive tween id's as their first argument. Currently takes only a max of 3 optional arguments.
The following constants can be used for selecting tweens:
0 = TWEENS_ALL
1 = TWEENS_GROUP
2 = TWEENS_TARGET

TweensExecute(tweens,data,script[,...])
tweens Tweens selection constant -- TWEENS_****
data Relevant group or target for tween selection
script Script to have each tween execute
... Optional arguments to pass to script

Returns: na

Example
// Execute 'TweenStop' for all tweens, including those with deactivated targets
TweensExecute(TWEENS_ALL, 0, true, TweenStop);
        
// Execute 'TweenPause' with tweens belonging to group 2
TweensExecute(TWEENS_GROUP, 2, false, TweenPause)
        
// Execute 'TweenSetTime' for tweens associated with obj_Jumpy
TweensExecute(TWEENS_TARGET, obj_Jumpy, false, TweenSetTime, 2.0);


TPExt
A convenient way to pass varying number of arguments to extended property setters if parameter count exceeds script argument limitations.

TPExt(arg0,...)
arg0... Values to pass to extended property script

Returns: array

Example
// Play tween passing coordinates to extended parameters
TweenFire(id, ext_xy__, EaseInQuad, 0, true, 0.0, 1.0, x, mouse_x, y, mouse_y);

// Convert coordinates to array and pass as extended data. Will do the same as above.
var _coords = TPExt(x, mouse_x, y, mouse_y);
TweenFire(id, ext_xy__, EaseInQuad, 0, true, 0.0, 1.0, _coords);


TweenCalc
Returns eased value based on a tween's current state.
NOTE: Setting a tween's property as an empty string “” will prevent a tween from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().

TweenCalc(tween)
tween Tween id

Returns: real

Example
// Fire tween with null property
tween = TweenFire(id, “”, EaseOutQuad, 0, true, 0.0, 1.0, 0, 100);

// Get eased value from tween's current state
value = TweenCalc(tween);


TweenCalcAmount
Returns eased value based on a tween at a relative point in time (0.0 – 1.0).
NOTE: Setting a tween's property as an empty string “” will prevent a tween from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().

TweenCalcAmount(tween,amount)
tween Tween id
amount Relative amount between 0.0 - 1.0

Returns: real

Example
// Fire tween with null property
tween = TweenFire(id, “”, EaseOutQuad, 0, true, 0.0, 1.0, 0, 100);

// Get eased value from tween at 1/4 time
value = TweenCalcAmount(tween, 0.25);


TweenCalcTime
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 a tween from being calculated unless manually done so with TweenCalc(), TweenCalcAmount, or TweenCalcTime().

TweenCalcTime(tween,time)
tween Tween id
time A specific time in seconds or steps

Returns: real

Example
// Fire tween with null property
tween = TweenFire(id, “”, EaseOutQuad, 0, true, 0.0, 12.0, 0, 100);

// Get eased value from tween at 5 seconds time
value = TweenCalcTime(tween, 5.0);


TweenAddCallback
Adds a callback script to be executed for the indicated event. Multiple callbacks can be added to a single event.

TweenAddCallback(tween,event,target,script[,arg0,arg1,...])
tween Tween id
event Tween event constant (TWEEN_EV_****)
target Instance environment to call script
script Name of custom script to call
arg0... Optional arguments to pass to script

Returns: callback id

Example
// Create tween
tween = TweenCreate(id);
// Show “Finished!” message when tween finishes playing
cb = TweenAddCallback(tween, TWEEN_EV_FINISH, id, ShowMessage, “Finished!”);


TweenAddCallbackUser
Adds a user event to be called for the indicated tween event. Multiple callbacks can be added to a single tween event.

TweenAddCallbackUser(tween,event,target,user_event)
tween Tween id
event Tween event constant (TWEEN_EV_****)
target Instance environment to call script
user_event User defined event to call for target

Returns: callback id

Example
// Create tween
tween = TweenCreate(id);
// Execute user defined event '2' when tween finishes playing
cb = TweenAddCallbackUser(tween, TWEEN_EV_FINISH, id, 2);


TweenCallbackInvalidate
Invalidates the specified callback, removing it from it's relevant tween event.

TweenCallbackInvalidate(callback)
callback Callback id

Returns: na

Example
// Create new tween
tween = TweenCreate(id);
// Add callback to FINISH event
cb = TweenAddCallback(tween, TWEEN_EV_FINISH id, ShowMessage, “Finished!”);
// Invalidate the added callback
TweenCallbackInvalidate(cb);


TweenCallbackIsValid
Returns true if the specified callback is valid.

TweenCallbackIsValid(callback)
callback Callback id

Returns: bool

Example
/ Invalidate callback if it is valid
if (TweenCallbackIsValid(callback))
{
    TweenCallbackInvalidate(callback);
}



TweenCallbackNull
Returns a null callback which can be safely called without error.

TweenCallbackNull()
 

Returns: null callback id

Example
// Nullify callback handle
cb = TweenCallbackNull();
// Does not cause error
TweenCallbackInvalidate(cb);


TweenCallbackEnable
Allows specified callbacks to be enabled or disabled.

TweenCallbackEnable(callback,enable)
callback Callback id
enable Enable callback?

Returns: na

Example
// Create new tween
tween = TweenCreate(id);
// Add callback to FINISH event
cb = TweenAddCallback(tween, TWEEN_EV_FINISH id, ShowMessage, “Finished!”);
// Disable callback
TweenCallbackEnable(cb, false);


TweenCallbackIsEnabled
Returns true if the specified callback is enabled

TweenCallbackIsEnabled(callback)
callback Callback id
Returns: bool

Example
// Invalidate callback if it is valid
if (TweenCallbackIsValid(cb))
{
    TweenCallbackInvalidate(cb);
}


TweenEventClear
Removes all callbacks from a specified tween event.

TweenEventClear(tween,event)
tween Tween id
event Tween event constant -- TWEEN_EV_****

Returns: na

Example
// Create a new tween
tween = TweenCreate(id, x__, false);
// Add callback to PLAY event
TweenAddCallback(tween, TWEEN_EV_PLAY, id, ShowFireworks);
TweenAddCallback(tween, TWEEN_EV_PLAY, id, AddNumbers, 4, 15);
// Remove callbacks added to tween's PLAY event.
TweenEventClear(tween, TWEEN_EV_PLAY);


TweenEventEnable
Enables or disables execution of callbacks for a tween's specified event.

TweenEventEnable(tween,event,enable)
tween Tween id
event Tween event constant -- TWEEN_EV_****
enable Enable event?

Returns: na

Example
// Disable STOP event
TweenEventEnable(tween, TWEEN_EV_STOP, false);
// Stop tween -- STOP event callbacks won't execute
TweenStop(tween);


TweenEventIsEnabled
Returns true if the specified tween event is enabled

TweenEventIsEnabled(tween,event)
tween Tween id
event Tween event constant -- TWEEN_EV_****

Returns: bool

Example
// Disable PAUSE event if it is enabled
if (TweenEventIsEnabled(tween, TWEEN_EV_PAUSE))
{
    TweenEventEnable(tween, TWEEN_EV_PAUSE, false);
}


TweenSimpleUseDelta
Sets following simple tween calls to use seconds(delta) or step timing. Default = step

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 seconds(delta) timing
TweenSimpleRotate(0, 360, 2.0, EaseInOutSine);


TweenSimpleMove
Eases an instance between two positions.

TweenSimpleMove(x1,y1,x2,y2,dur,ease[,delay])
x1 x start
y1 y start
x2 x destination
y2 y destination
dur Duration of tween in steps or seconds
ease Easing algorithm script
delay (optional) Duration delay start of tween

Returns: tween id

Example
// Move instance to mouse location
tween = TweenSimpleMove(x, y, mouse_x, mouse_y, 30, EaseInQuart);


TweenSimpleScale
Eases the image xscale and image yscale of an instance between two values.

TweenSimpleScale(xscale1,yscale1,xscale2,yscale2,dur,ease[,delay])
xscale1 Image scale x start
yscale1 Image scale y start
xscale2 Image scale x destination
yscale2 Image scale y destination
dur Duration fo tween in steps or seconds
ease Easing algorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Scale instance to half size over 30 steps
tween = TweenSimpleScale(1.0, 1.0, 0.5, 0.5, 30, EaseInQuad);


TweenSimpleRotate
Eases the image angle of an instance between two values.

TweenSimpleRotate(angle1,angle2,dur,ease[,delay])
angle1 Image angle start
angle2 Image angle destination
dur Duration of tween in steps or seconds
ease Easing algorithm script
dur (optional) Duration to delay start of tween

Returns: tween id

Example
// Rotate instance one full rotation over 30 steps
tween = TweenSimpleRotate(0, 360, 30, EaseOutQuad);


TweenSimpleMoveInt
Eases an instance between two positions. The x/y values are rounded to whole numbers.

TweenSimpleMoveInt(x1,y1,x2,y2,dur,ease[,delay])
x1 x start
y1 y start
x2 x destination
y2 y destination
dur Duration of tween in steps or seconds
ease Easing algorithm script
delay (optional) Duration of time to delay start of tween

Returns: tween id

Example
// Move instance to mouse location
tween = TweenSimpleMoveInt(x, y, mouse_x, mouse_y, 30, EaseInQuart);


TweenSimpleFade
Eases the image alpha of an instance between two values.

TweenSimpleFade(alpha1,alpha2,dur,ease[,delay])
alpha1 Alpha start
alpha2 Alpha destination
dur Duration of tween in steps or seconds
ease Easing alorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Fade in instance over 30 steps
tween = TweenSimpleFade(0.0, 1.0, 30, EaseInOutCubic);


TweenSimpleCycleImages
Eases image_index of instance between two values.

TweenSimpleCycleImages(index1,index2,dur,ease[,delay])
index1 Image index start
index2 Image index destination
dur Duration of tween in steps or seconds
ease Easing alorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Play through an instance's sprite images over 100 steps
tween = TweenSimpleCycleImages(0, image_number-1, 100, EaseInSine);


TweenSimpleColour
Eases an instances image_blend value between two colours

TweenSimpleColour(col1,col2,dur,ease[,delay])
col1 Starting image blend colour
col2 Destination image blend colour
dur Duration of tween in steps or seconds
ease Easing alorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Change instance's image_blend from white to red over 30 steps
tween = TweenSimpleColour(c_white, c_red, 30, EaseInSine);


TweenSimpleSpeedRamp
Eases the speed of an instance between two values.

TweenSimpleSpeedRamp(speed1,speed2,dur,ease[,delay])
speed1 Starting speed
speed2 Destination speed
dur Duration of tween in steps or seconds
ease Easing alorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Double an instance's speed over 60 steps
tween = TweenSimpleSpeedRamp(speed, speed*2, 60, EaseOutCubic);


TweenSimpleHVSpeedRamp
Eases the hspeed and vspeed of an instance between two values.

TweenSimpleHVSpeedRamp(hspeed1,vspeed1,hspeed2,vspeed2,dur,ease[,delay])
hspeed1 Starting horizontal speed
vspeed1 Starting vertical speed
hspeed2 Destination horizontal speed
vspeed2 Destination vertical speed
dur Duration of tween in steps or seconds
ease Easing alorithm script
delay (optional) Duration to delay start of tween

Returns: tween id

Example
// Ease hspeed and vspeed to 25% and 50% over 20 steps
tween = TweenSimpleHVSpeedRamp(hspeed, vspeed, hspeed*0.25, vspeed*0.5, 20, EaseOutQuint);


TweenSetGroup
Designates tween to a specified group. Group must be a real number.

TweenSetGroup(tween,group)
tween Tween id
group Group number

Returns: na

Example
// Create tween and assign it to group 2
tween = TweenCreate(id, x__, false);
TweenSetGroup(tween, 2);


TweenSetTimeScale
Manipulates the rate at which a tween's internal timing will udpate.
A value above 1.0 increases a tween's speed.
A value between 0.0 - 1.0 will decrease a tween's speed.
Use negative values at your own risk!

TweenSetTimeScale(tween,scale)
tween Tween id
scale Timing scale factor (Default = 1.0)

Returns: na

Example
// Fire a tween
tween = TweenFire(id, x__, EaseInQuad, 0, true, 0.0, 5.0, x, mouse_x);

// Have tween run at 2x speed
TweenSetTimeScale(tween, 2.0);

// Have tween run at half speed
TweenSetTimeScale(tween, 0.5);


TweenSetTime
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
// Fire a tween
TweenFire(id, image_angle__, EaseInOutBack, 0, true, 0.0, 5.0, 0, 360);
// Jump tween to middle of duration
TweenSetTime(tween, 0.5*TweenGetTime(tween));


TweenSetTarget
Sets the instance to be associated with a specified tween.

TweenSetTarget(tween,target)
tween Tween id
target Instance id

Returns: na

Example
// Create a new tween
tween = TweenCreate(id);
// Assign tween a new target instance
TweenSetTarget(tween, obj_Player);


TweenSetProperty
Sets the property script to be used. Can also take a single-index array or null "" string.

TweenSetProperty(tween,prop)
tween Tween id
prop Property setter

Returns: na

Example
// Set tween to ease scale
TweenSetProperty(tween, scale__);
// Set tween to not be automatically calculated
TweenSetProperty(tween, "");


TweenSetDelta
Switches tween between usingseconds(delta) and step based timing.

TweenSetDelta(tween,delta)
tween Tween id
delta Use seconds(delta) timing?
Returns: na

Example
// Create tween which uses step timing
tween = TweenCreate(id, x__, EaseInOutQuad, 0, false, 0.0, 10, x, mouse_x);
// Switch tween to use delta(seconds) timing instead
TweenSetDelta(tween, true);


TweenSetStart
Changes the starting value for a specified tween.

TweenSetStart(tween,start)
tween Tween id
start New start value
Returns: na

Example
TweenSetStart(tween, 0);


TweenSetDestination
Sets a new destination for the specified tween.

TweenSetDestination(tween,dest)
tween Tween id
dest New destination value
Returns: na

Example
// Fire tween
tween = TweenFire(id, y__, EaseInQuint, 0, true, 0.0, 1.0, y, mouse_y);
// Change tween's destination
TweenSetDestination(tween, mouse_y+100);


TweenSetDuration
Changes the length of time for a tween to play, in steps or seconds.

TweenSetDuration(tween,dur)
tween Tween id
dur Duration of time in steps or seconds
Returns: na

Example
// Fire tween
TweenFire(id, image_scale__, EaseInQuad, 2, true, 0.0, 1.0, 1, 2);
// Double a tweens duration
TweenSetDuration(tween, 2*TweenGetDuration(tween)); 


TweenSetDelay
Changes the remaining time of a tween's active delay counter. A tween must be actively delayed for this to work.

TweenSetDelay(tween,delay)
tween Tween id
delay Active delay value in steps or seconds
Returns: na

Example
// Fire a tween delayed by 5 seconds
TweenFire(id, image_alpha__, 0, EaseInOutQuad, true, 5.0, 1.0, 1, 0);
// Halve the active delay timer
TweenSetDelay(tween, 0.5*TweenGetDelay(tween));


TweenSetDelayStart
Changes the starting delay value for a defined tween. This has no effect on active delays.

TweenSetDelayStart(tween,delay)
tween Tween id
delay Starting delay value in steps or seconds
Returns: na

Example
// Create a defined tween with a 2 second delay
tween = TweenCreate(id, x__, EaseOutElastic, 0, true, 2.0, 1.0, x, mouse_x);
// Change the delay value for defined tween
TweenSetDelayStart(tween, 5.0);
// Play defined tween with updated delay value
TweenPlay(tween);


TweenSetMode
Changes a tween's play mode. Can use any TWEEN_MODE_* constant.

TweenSetMode(tween,mode)
tween Tween id
mode Tween play mode constant -- TWEEN_MODE_*
Returns: na

Example
// Fire a tween
tween = TweenFire(id, x__, EaseLinear, TWEEN_MODE_ONCE, true, 0.0, 1.0, x, mouse);
// Change tween's mode to patrol
TweenSetMode(tween, TWEEN_MODE_PATROL);


TweenSetEase
Changes the easing algorithm used by the specified tween.

TweenSetEase(tween,ease)
tween Tween id
ease Easing algorithm script
Returns: na

Example
// Fire a tween using linear ease
tween = TweenFire(id, x__, EaseLinear, 0, true, 0.0, 1.0, x, mouse_x);
// Update tween to use EaseInOutCubic
TweenSetEase(tween, EaseInOutCubic);


TweenSetExtData
Updates the extended property setter data for a specified tween.

TweenSetExtData(tween,arg0,...)
tween Tween id
arg0... Variable number of arguments to pass as extended data
Returns: na

Example
// Fire a tween with extended property
tween = TweenFire(id, ext_xy__, EaseOutQuad, 0, true, 0.0, 1.0, 0, 1, x, mouse_x, y, mouse_y);

// Change the extended data's x/y values
TweenSetExtData(tween, x, mouse_x+20, y, y-100);

// OR... Get existing extended data and modify it
extData = TweenGetExtData(tween);
extData[0] = extData[0]+100; // Update x1
extData[1] = 200; // Update x2
// Pass updated data back to tween
TweenSetExtData(tween, extData);

// OR... directly update extended data with '@' array reference accessor
extData[@ 2] = mouse_y - 100;  // Update y1
extData[@ 3] = extData[3]+100; // Update y2


TweenGetGroup
Returns the group number which a specified tween belongs to.

TweenGetGroup(tween)
tween Tween id
Returns: real

Example
// Pause tween if it belongs to specific group
if (TweenGetGroup(tween) == 2)
{
    TweenPause(tween);
}


TweenGetTimeScale
Returns the time scale for a specified tween.

TweenGetTimeScale(tween)
tween Tween id
Returns: real

Example
Halve the time scale of a tween
TweenSetTimeScale(tween, 0.5*TweenGetTimeScale(tween));


TweenGetTime
Returns the current time for a specified tween along its total duration.

TweenGetTime(tween)
tween Tween id
Returns: real

Example
Halve the progressed time of an active tween
TweenSetTime(tween, 0.5*TweenGetTime(tween));


TweenGetTarget
Returns the target instance for a specified tween.

TweenGetTarget(tween)
tween Tween id
Returns: instance id

Example
Stop tween if it is associated with player
if (TweenGetTarget(tween) == obj_Player.id)
{
    TweenStop(tween);
}


TweenGetProperty
Returns the property of a specified tween.

TweenGetProperty(tween)
tween Tween id
Returns: tween property

Example
Set the property of one tween to another
TwenSetProperty(tween1, TweenGetProperty(tween2));


TweenGetDelta
Returns whether or not a tween uses seconds(true) or steps(false) for timing.

TweenGetDelta(tween)
tween Tween id
Returns: bool

Example
Check tween for timing mode before updating its duration
if (TweenGetDelta(tween))
{
    TweenSetDuration(tween, 2.0);
}
else
{
    TweenSetDuration(tween, 2*room_speed);
}


TweenGetStart
Returns the starting value for a tween's property

TweenGetStart(tween)
tween Tween id
Returns: real

Example
Jump instance to a tween's starting x value
obj_Player.x = TweenGetStart(tween_x);


TweenGetDestination
Returns the destination value for a tween's property

TweenGetDestination(tween)
tween Tween id
Returns: real

Example
Jump instance to a tween's destination x value
obj_Player.x = TweenGetDestination(tween_x);


TweenGetDuration
Returns a tween's total duration in steps or seconds.

TweenGetDuration(tween)
tween Tween id
Returns: real

Example
Double a tweens total duration
TweenSetDuration(tween, 2*TweenGetDuration(tween));


TweenGetDelay
Returns the remaining delay counter of a delayed tween. Returns 0 if tween has no active delay.

TweenGetDelay(tween)
tween Tween id
Returns: real

Example
Double the remaining time of a delay counter
TweenSetDelay(tween, 2*TweenGetDelay(tween));


TweenGetDelayStart
Returns the starting delay value of a tween. Returned value DOES NOT reflect active delay counters.

TweenGetDelayStart (tween)
tween Tween id
Returns: real

Example
Double the delay for a defined tween when it is played
TweenSetDelayStart(tween, 2*TweenGetDelayStart(tween));
TweenPlay(tween);


TweenGetMode
Returns the play mode used by a specified tween.

TweenGetMode(tween)
tween Tween id
Returns: real

Example
Copy mode of one tween to another
TweenSetMode(tween1, TweenGetMode(tween2));


TweenGetEase
Returns the ease algorithm used by a specified tween.

TweenGetEase(tween)
tween Tween id
Returns: real

Example
Copy ease of one tween to another
TweenSetEase(tween1, TweenGetEase(tween2));


TweenGetExtData
Returns the extended property-setter data for a tween. Can be useful for updating extended data directly or with TweenSetExtData().

TweenGetExtData(tween)
tween Tween id
Returns: extended data

Example
Get a tween's extended data and modify it
extData = TweenGetExt(tween);
extData[0] = x; extData[1] = mouse_x;
extData[2] = y; extData[3] = mouse_y;
Assign updated extended data back to tween
TweenSetExtData(tween, extData);

// OR... modify the data directly using '@' array reference accessor
extData[@ 1] = 200;
extData[@ 3] = extData[3]+100;


TweenGetState
Returns the state of a specified tween.

TweenGetState(tween)
tween Tween id
Returns: real

Example
Check if a tween's state is the same as another
if (TweenGetState(tween1) == TweenGetState(tween2))
{
    show_message("Tweens have same state!");
}


TweenGetChange
Returns the change of a specified tween. (Start-Destination)

TweenGetChange(tween)
tween Tween id
Returns: real

Example
Show a tween's total change
show_message(TweenGetChange(tween));


TweenSystemGetEnabled
Returns whether or not the tweening system is enabled.

TweenSystemGetEnabled()
   
Returns: bool

Example
// Pause tweening system if it is enabled
if (TweenSystemGetEnabled())
{
    TweenSystemSetEnabled(false);
}


TweenSystemGetTimeScale
Returns the global time scale used by the tweening system.

TweenSystemGetTimeScale()
   
Returns: real

Example
// Double the current system's time scale
TweenSystemSetTimeScale(2*TweenSystemGetTimeScale());


TweenSystemGetUpdateInterval
Returns the system's update interval. (Default = 1)

TweenSystemGetUpdateInterval()
   
Returns: real

Example
// Have system update every 2 steps if update interval equals 1
if (TweenSystemGetUpdateInterval() == 1)
{
	TweenSystemSetUpdateInterval(2);
}


TweenSystemSetEnabled
Changes the enabled/paused state of the tweening system.

TweenSystemSetEnabled(enable)
enable Enable the tweening system?
Returns: na

Example
// Resume tweening system if not enabled
if (TweenSystemGetEnabled() == false)
{
	TweenSystemSetEnabled(true);
}


TweenSystemSetTimeScale
Changes the global time scale used by the tweening system. Has an affect on the speed of all tweens.
Use negative values at your own risk!!
(Default = 1.0)

TweenSystemSetTimeScale(scale)
scale Relative speed to process tweens
Returns: na

Example
// Have tweening system run at half speed (slow motion)
TweenSystemSetTimeScale(0.5);


TweenSystemSetUpdateInterval
Changes the step interval at which the tweening system updates.
This can be useful where, for example, a game runs at 60fps but you want the tweening system to update at 30fps.
(Default = 1.0)

TweenSystemSetUpdateInterval(interval)
interval Number of steps before system updates (default=1)
Returns: na

Example
// Have tweening system update every 2 steps
TweenSystemSetUpdateInterval(2);


TweenSystemSetMinDeltaFPS
Sets the minimum frame rate before delta timing will begin to lag behind.
Default = 10

TweenSystemSetMinDeltaFPS(fps)
fps Frame rate (Default=10)
Returns: na

Example
// Change minimum frame rate to 15
TweenSystemSetMinDeltaFPS(15);


TweenSystemSetAutoCleanIterations
Sets the number of tweens to be checked each step by the system's memory-manager. A higher value can remove destroyed tweens from the system faster, but can have a negative impact on performance.
Default = 10

TweenSystemSetAutoCleanIterations(iterations)
interations Number of tweens to check each step
Returns: na

Example
// Increase number of tweens to be checked by memory-manager
TweenSystemSetAutoCleanIterations(30);


TweenSystemDeltaTime
Returns the internal delta time used by the system. Can return the value affected by the system's time scale.

TweenSystemDeltaTime(scaled)
scaled Whether or not to return time affected by system's time scale
Returns: real

Example
// Cache system's internal delta time value
tweenDelta = TweenSystemDeltaTime(true);
// Move player's x 100 pixels per second using tween system delta
obj_Player.x += 100*tweenDelta;


TweenSystemClearRoom
Clears inactive tweening data associated with a persistent room.

TweenSystemClearRoom(room)
room Room id
Returns: na

Example
// Clear inactive tweening data for persistent room
TweenSystemClearRoom(rm_PauseScreen);


TweenSystemClearAllRooms
Clears inactive tweening data associated with all persistent rooms.

TweenSystemClearAllRooms()
   
Returns: na

Example
// Clear all inactive tweening data for all persistent rooms
TweenSystemClearAllRooms();


TweenSystemFlushDestroyed
Overrides the system's memory manager by immediately removing all destroyed tweens from the system.
May cause stutter if many tweens to be removed.

TweenSystemFlushDestroyed()
   
Returns: na

Example
// Immediately remove all destroyed tweens from system
TweenSystemFlushDestroyed();


TweenSystemCount
Returns the total number of tweens in the system.
This also includes destroyed tweens not yet removed by the memory-manager.

TweenSystemCount()
   
Returns: real

Example
// Draw the total number of tweens in system
draw_text(x, y, TweenSystemCount());


TweenSystemCountPlaying
Returns the total number of tweens actively playing.

TweenSystemCountPlaying()
   
Returns: real

Example
// Draw the total number of playing tweens
draw_text(x, y, TweenSystemCountPlaying());


TweenSystemCountPaused
Returns the total number of paused tweens.

TweenSystemCountPaused()
   
Returns: real

Example
// Draw the total number of paused tweens
draw_text(x, y, TweenSystemCountPaused());


TweenSystemCountStopped
Returns the total number of stopped tweens.

TweenSystemCountStopped()
   
Returns: real

Example
// Draw the total number of Stopped tweens
draw_text(x, y, TweenSystemCountStopped());


SharedTweenerActivate
Activates the shared tweener in case it has been deactivated by instance_deactivate* functions.

SharedTweenerActivate()
   
Returns: na

Example
// Deactivate all objects
instance_deactivate_all(true);
// Reactivate shared tweener
SharedTweenerActivate();


SharedTweenerDestroy
Destroys the shared tweener, effectively clearing the system.

SharedTweenerDestroy ()
   
Returns: na

Example
// Clear the tweening system
SharedTweenerDestroy();