
While Tween.js tries to be performant on its own, nothing prevents you from using it in a way that is counterperformant. You can’t make property A change with an array and a Linear function, and property B with an array too and a Bezier function using the same tween you should use two tween objects running over the same object but modifying different properties and using different interpolation functions.Ĭheck 06_array_interpolation for an example. Note that the interpolation function is global to all properties that are tweened with arrays in the same tween. But you need to use quotes or the values will be taken as absolute. When the tween is started, Tween.js will read the current property values and apply the relative values to find out the new final values.

You can also use relative values when using the to method. The tweened object is passed in as the first parameter. onRepeatĮxecuted whenever a tween has just finished one repetition and will begin another. onCompleteĮxecuted when a tween is finished normally (i.e.

onUpdateĮxecuted each time the tween is updated, after the values have been actually updated. onStopĮxecuted when a tween is explicitly stopped via stop(), but not when it is completed normally, and before stopping any possible chained tween. It is great for synchronising to other events or triggering actions you want to happen when a tween starts. it will not be run when the tween is repeated via repeat(). This will be executed only once per tween, i.e. onStartĮxecuted right before the tween starts animating, after any delay time specified by the delay method.

The scope for each callback is the tweened object–in this case, obj.
