new Tween(object)
Javascript Tweening Engine
Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equation
https://github.com/sole/Tween.js
author sole / http://soledadpenades.com
author mr.doob / http://mrdoob.com
author Robert Eisele / http://www.xarg.org
author Philippe / http://philippe.elsass.me
author Robert Penner / http://www.robertpenner.com/easing_terms_of_use.html
author Paul Lewis / http://www.aerotwist.com/
author lechecacharro
author Josh Faul / http://jocafa.com/
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | object on which to apply the tween |
Example
// add a tween to change the object pos.y variable to 200 in 3 seconds
tween = new me.Tween(myObject.pos).to({y: 200}, 3000).onComplete(myFunc);
tween.easing(me.Tween.Easing.Bounce.Out);
tween.start();
Members
-
static, constant Easing :enum
-
Easing Function :
me.Tween.Easing.Linear.None
me.Tween.Easing.Quadratic.In
me.Tween.Easing.Quadratic.Out
me.Tween.Easing.Quadratic.InOut
me.Tween.Easing.Cubic.In
me.Tween.Easing.Cubic.Out
me.Tween.Easing.Cubic.InOut
me.Tween.Easing.Quartic.In
me.Tween.Easing.Quartic.Out
me.Tween.Easing.Quartic.InOut
me.Tween.Easing.Quintic.In
me.Tween.Easing.Quintic.Out
me.Tween.Easing.Quintic.InOut
me.Tween.Easing.Sinusoidal.In
me.Tween.Easing.Sinusoidal.Out
me.Tween.Easing.Sinusoidal.InOut
me.Tween.Easing.Exponential.In
me.Tween.Easing.Exponential.Out
me.Tween.Easing.Exponential.InOut
me.Tween.Easing.Circular.In
me.Tween.Easing.Circular.Out
me.Tween.Easing.Circular.InOut
me.Tween.Easing.Elastic.In
me.Tween.Easing.Elastic.Out
me.Tween.Easing.Elastic.InOut
me.Tween.Easing.Back.In
me.Tween.Easing.Back.Out
me.Tween.Easing.Back.InOut
me.Tween.Easing.Bounce.In
me.Tween.Easing.Bounce.Out
me.Tween.Easing.Bounce.InOut -
static, constant Interpolation :enum
-
Interpolation Function :
me.Tween.Interpolation.Linear
me.Tween.Interpolation.Bezier
me.Tween.Interpolation.CatmullRom
Methods
-
chain(chainedTween)
-
chain the tween
Parameters:
Name Type Description chainedTween
me.Tween Tween to be chained
-
delay(amount)
-
delay the tween
Parameters:
Name Type Description amount
Number delay amount expressed in milliseconds
-
easing(fn)
-
set the easing function
Parameters:
Name Type Description fn
me.Tween.Easing easing function
-
interpolation(fn)
-
set the interpolation function
Parameters:
Name Type Description fn
me.Tween.Interpolation interpolation function
-
onComplete(onCompleteCallback)
-
onComplete callback
Parameters:
Name Type Description onCompleteCallback
function callback
-
onStart(onStartCallback)
-
onStart callback
Parameters:
Name Type Description onStartCallback
function callback
-
onUpdate(onUpdateCallback)
-
onUpdate callback
Parameters:
Name Type Description onUpdateCallback
function callback
-
repeat(times)
-
Repeat the tween
Parameters:
Name Type Description times
Number amount of times the tween should be repeated
-
start()
-
start the tween
-
stop()
-
stop the tween
-
to(properties, durationopt)
-
object properties to be updated and duration
Parameters:
Name Type Attributes Default Description properties
Object hash of properties
duration
Number <optional>
1000 tween duration
-
yoyo(yoyo)
-
Allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
Parameters:
Name Type Description yoyo
Boolean - See: