Global Command: startObjectTween

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected from StartObjectTween)

Start tween on a Visionaire object field. The field value is changed over a certain period of time from a start value to a target value. Tweens are overwritten if they are set again.

Related functions startTween


Syntax

startObjectTween(target, targetfield, from, to, duration, easing [, repeat, reverse_repeat])


Parameters

Parameter Type Description
target TVisObj Visionaire object, containing a field to start tweening on.
targetfield integer Field (of the Visionaire object defined in "target") to start tweening on.
from integer/float/t_point Tween start value. The Visionaire "t_point" field is an associative array with the elements x (int) and y (int).
to integer/float/t_point Tween target value. The Visionaire "t_point" field is an associative array with the elements x (int) and y (int).
duration float Amount of time the tween takes (in milliseconds).
easing integer Type of easing. See the easings enumeration (Luadocs) for all supported values. Previews for easing types can found on easings.net.
repeat boolean If true the tween starts again from the beginning after reaching the target value, looping infinitely. Default value is false.
reverse_repeat boolean Only applicable if "repeat" is true. If true the tween runs backwards after reaching the target value and forwards again after reaching the start value, pendulum-wise. Default value is false.


Return values

none


Examples

Example 1: Tween the game's scroll position to {x=100,y=0} over a period of 3 seconds, resulting in a scene pan (if the current scene is wider than the screen resolution).

startObjectTween(game, VGameScrollPosition, game.ScrollPosition, {x=100,y=0}, 3000, easeBackInOut)