Menu

Tween Control Parameters

Charles Patterson

Tween Control Parameters

A Tween is tweaked by its control parameters. This is the fourth formal parameter in any of the creation methods, and is expressed in Twillex Combined Argument Format. For example,

myTweenEngine.to(%duration, %target, %fields, %control);

where %control may be "repeat:0, ease:linear, onComplete:myCompleteFunction" for instance.

Control parameters might, for example, cause a Tween to repeat, use easing to animate the flow from start to end, and/or delete upon completion. All of a Tween's control parameters are combined into one using the Twillex Combined Argument Format, for example, "delete:true, yoyo:true, repeat:1".

Parameter Meaning Default
delete If true, when Tween completes, delete it. false
ease interpolation method. see Tween Easing Options linear
repeat The number of times to run the Tween. A value of 0 means run once (no repeats) and a value of 3 means run 4 times total. See fit for duration information. 0.
yoyo If true, run the Tween backwards when it reaches the end. Note that the ease will also run backwards so that if you use quint_out, the animation will start fast and slow down until it hits the end. Then it will start slow and run fast towards the beginning. See fit for duration information. false.
flipflop If true, run the Tween backwards when it reaches the end, BUT run the ease forward. That is, if you have an ease of quint_out, the Tween will start fast and slow down going each way. See fit for duration information. false
relative If true, end values are relative to start values false
oncomplete If set, when playing reaches end, call() the function given unset
onchange If set, when Tween updates values, call() the function given unset
around If true, play Tween around start value. This is mostly for yoyo or flipflop Tweens which might work best tweening through the start point false
loop If true, replay forever. false
fit If true (the default), all repeats, yoyoing, and flipflopping fit within the given duration for the Tween. If false, each repeat takes the entire duration to complete, and each direction of either a yoyo or flipflop gets the entire duration. true

Related

Wiki: Tween Creation
Wiki: Tween Easing Options
Wiki: Twillex Combined Argument Format

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.