Tween

class Tween

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/

Constructor


new Tween(object: object) → {}
// add a tween to change the object pos.x and pos.y variable to 200 in 3 seconds
tween = new me.Tween(myObject.pos).to({
      x: 200,
      y: 200,
   }, {
      duration: 3000,
      easing: me.Tween.Easing.Bounce.Out,
      autoStart : true
}).onComplete(myFunc);
Parameters:
Name Type Description
object object

object on which to apply the tween

Public Methods


chain tween.js:295
chain(chainedTween: Tween) → {Tween}

chain the tween

Parameters:
Name Type Description
chainedTween Tween

Tween(s) to be chained

Returns:
Type Description
Tween

this instance for object chaining

delay tween.js:219
delay(amount: number) → {Tween}

delay the tween

Parameters:
Name Type Description
amount number

delay amount expressed in milliseconds

Returns:
Type Description
Tween

this instance for object chaining

easing tween.js:266
easing(easing: Easing) → {Tween}

set the easing function

Parameters:
Name Type Description
easing Easing

easing function

Returns:
Type Description
Tween

this instance for object chaining

interpolation tween.js:282
interpolation(interpolation: Interpolation) → {Tween}

set the interpolation function

Parameters:
Name Type Description
interpolation Interpolation

interpolation function

Returns:
Type Description
Tween

this instance for object chaining

onComplete tween.js:334
onComplete(onCompleteCallback: Function) → {Tween}

onComplete callback

Parameters:
Name Type Description
onCompleteCallback Function

callback

Returns:
Type Description
Tween

this instance for object chaining

onStart tween.js:308
onStart(onStartCallback: Function) → {Tween}

onStart callback

Parameters:
Name Type Description
onStartCallback Function

callback

Returns:
Type Description
Tween

this instance for object chaining

onUpdate tween.js:321
onUpdate(onUpdateCallback: Function) → {Tween}

onUpdate callback

Parameters:
Name Type Description
onUpdateCallback Function

callback

Returns:
Type Description
Tween

this instance for object chaining

repeat tween.js:234
repeat(times: number) → {Tween}

Repeat the tween

Parameters:
Name Type Description
times number

amount of times the tween should be repeated

Returns:
Type Description
Tween

this instance for object chaining

start tween.js:160
start(time: number) → {Tween}

start the tween

Parameters:
Name Type Attributes Description
time number

<optional>

the current time when the tween was started

Returns:
Type Description
Tween

this instance for object chaining

stop tween.js:206
stop() → {Tween}

stop the tween

Returns:
Type Description
Tween

this instance for object chaining

to tween.js:119
to(properties: object, options: object | number) → {Tween}

object properties to be updated and duration

Parameters:
Name Type Attributes Description
properties object

hash of properties

options object | number

<optional>

object of tween properties, or a duration if a numeric value is passed

options.duration number

<optional>

tween duration

options.easing Easing

<optional>

easing function

options.delay number

<optional>

delay amount expressed in milliseconds

options.yoyo boolean

<optional>

allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.

options.repeat number

<optional>

amount of times the tween should be repeated

options.interpolation Interpolation

<optional>

interpolation function

options.autoStart boolean

<optional>

allow this tween to start automatically. Otherwise call me.Tween.start().

Returns:
Type Description
Tween

this instance for object chaining

yoyo tween.js:249
yoyo(yoyo: boolean) → {Tween}

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
Returns:
Type Description
Tween

this instance for object chaining

See: Tween#repeat

Powered by webdoc!