API Documentation

for 0.0.1
Show:

Animation Class

The Animation class provides a simple way to tween object properties

Constructor

Animation

(
  • params
)

Parameters:

  • params Object

    The parameters object

    • target Object

      The object whose propoerties are to be animated

    • [from] Object optional

      An object indicating the start values of the properties to animate, defaults to the values of the target

    • to Object

      An object indicating the finish values of the properties to animate

    • duration Number

      The animation duration in milliseconds

    • [easing=Animation.Easing.linear] Function optional

      An easing function to use

    • [repeat=0] Number optional

      The number of times the animation should be repeated, set to Infinity to repeat indefinately

    • [yoyo=false] Boolean optional

      If set to true and repeat is greater than 1, the animation will play in reverse once it reached the end

    • [delay=0] Number optional

      The number of milliseconds to wait for before starting the animation

    • [time] Time optional

      The Time instance to use for this Animation Component

    • [onStart] Function optional

      A callback to be called when the animation starts

    • [onUpdate] Function optional

      A callback to be called each time the animation is updated

    • [onRestart] Function optional

      A callback to be called each time the animation is repeated once it reached the end if repeat is greater than 1

    • [onStop] Function optional

      A callback to be called when the animation is stopped

    • [onResume] Function optional

      A callback to be called when the animation is resumed

    • [onFinish] Function optional

      A callback to be called when the animation reaches the end and no repetition is pending

Example:

//TODO

Methods

chain

()

Chain another animation once this one is finished

play

()

Play the animation

resume

()

Resume the animation

rewind

()

Rewind the animation back to its starting values

setup

()

Setup

stop

()

Stop the animation

update

()

Update the properties according to the elapsed time

Events

finish

Fired when the animation reaches the end and no repetition is pending

Event Payload:

  • target Object

    The target object

restart

Fired when each time the animation is repeated once it reached the end if repeat is greater than 1

Event Payload:

  • target Object

    The target object

  • direction Number

    The current direction

resume

Fired when the animation is resumed

Event Payload:

  • target Object

    The target object

start

Fired when the animation starts

Event Payload:

  • target Object

    The target object

stop

Fired when the animation is stopped

Event Payload:

  • target Object

    The target object

update

Fired each time the animation is updated

Event Payload:

  • target Object

    The target object