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:true
Returns:
Tween
β the newly created tween
Properties
Event Handlers
onUpdate
The 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.