Tween
Allows tweening Object properties between two states for a given duration. To tween properties on Paper.js Item instances, item.tween(from, to, options) can be used, which returns created tween instance.
Constructors
Tween(object, from, to, duration[, easing[, start]])Creates a new tween.
Parameters:
object:Objectβ the object to tween the properties onfrom:Objectβ the state at the start of the tweeningto:Objectβ the state at the end of the tweeningduration:Numberβ the duration of the tweeningeasing:StringβFunctionβ the type of the easing function or the easing function β optional, default:βlinearβstart:Booleanβ whether to start tweening automatically β optional, default:trueReturns:
Tweenβ the newly created tween
Properties
Event Handlers
onUpdateThe function to be called when the tween is updated. It receives an object as its sole argument, containing the current progress of the tweening and the factor calculated by the easing function.
Type:
Functionβnull
Example:Display tween progression values:
Methods
then(function)Set a function that will be executed when the tween completes.
Parameters:
function:Functionβ the function to execute when the tween completesReturns:
Tween
Example:Tweens chaining:
start()Start tweening.
Returns:
Tween
Example:Manually start tweening.
stop()Stop tweening.
Returns:
Tween
Example:Stop a tween before it completes.
Was this helpful?