API Docs for: v2.1.0
Show:

CGSGAnimationManager Class

Methods

addAnimationKey

(
  • timeline
  • frame
  • value
)

Add a key

Parameters:

  • timeline CGSGTimeline

    handler to the timeline to animate

  • frame Number

    the date for the key

  • value Number

    value for the attribute at the frame

Example:

this.sceneGraph.addAnimation(imgNode, "position.x", 2000, 200, "linear", true);

animate

(
  • node
  • attribute
  • duration
  • from
  • to
  • delay
)
CGSGTimeline

Animate an attribute of a nodes

Parameters:

  • node CGSGNode

    Handler to the nodes to animate

  • attribute String

    String representing the attribute to animate ("position.y", "rotation.angle", "fill", ...)

  • duration Number

    Duration of the animation, in frame

  • from Number

    Start value

  • to Number

    End value

  • delay Number

    Delay before start the animation, in frames

Returns:

CGSGTimeline:

the timeline on which tha the animation was added

Example:

CGSG.animationManager.animate(imgNode, "position.x", 700, 0, 200, 0, true);

createTimeline

(
  • node
  • attribute
)
CGSGTimeline private

Create a new timeline

Parameters:

  • node CGSGNode

    Handle to the nodes

  • attribute String

    the attribute name

Returns:

getTimeline

(
  • node
  • attribute
)
CGSGTimeline

Return the timeline corresponding with the nodes and attribute. Create it if does not exists yet

Parameters:

  • node CGSGNode

    Handle to the nodes

  • attribute String

    String. the attribute name

Returns:

removeAnimationKey

(
  • timeline
  • frame
)

Parameters:

stillHaveAnimation

() Boolean

Returns:

Boolean:

true if there is still animation key after the current frame

Properties

listTimelines

Array

List of the timelines for the animations. A timeline consists of a list of animation keys for 1 attribute of 1 node