Show:

CGSGTimeline Class

Methods

_computeStepsValues () private

Compute the number of steps between all keys, 2 by 2

addKey
(
  • frame.
  • value
)
public

Add a new animation key frame to the timeline and sort the timeline by frame number

Parameters:
computeValue
(
  • keyIndex
  • frame
  • method
)
private

Compute animated value for one frame between key ay index keyIndex and keyIndex+1

Parameters:
  • keyIndex Number

    Must be an integer value.

  • frame Number

    Must be an integer value.

  • method String

    = "linear"

Returns:
: Object with 2 properties : frame and value, or undefined if keyIndex < 0
computeValues
(
  • fromFrame
  • method
)
public

Compute all the values (steps) for the animation of this timeline

Parameters:
  • fromFrame Number

    first frame at which one the computing must start. Must be an integer value.

  • method String

    interpolation method : "linear" for this timeline instance

exportValues () Array

Return the precomputed array of values for this timeline

Returns:
getFirstKey () CGSGAnimationKey
Returns:
CGSGAnimationKey: the first key frame of this timeline
getLastKey () CGSGAnimationKey
Returns:
CGSGAnimationKey: the last key frame of this timeline
getNbKeys () Number public
Returns:
Number: the number of keys in this timeline. Must be an integer value.
getValue
(
  • frame
)
Number public

Get the value for the frame number passed in parameter

Parameters:
  • frame Number

    the frame bound with the returned value. Must be an integer value.

Returns:
Number: the interpolated value of the attribute at the specified frame If no key is defined, return undefined If there is only one key, return it's value If the frame is before the first key, return the first key value If the frame is after the last key, return the last key value
importValues
(
  • newValues
  • startFrame
)

Import new precomputed values for this timeline. The number of values must match the number of frame defined by the keys of this timeline

Parameters:
  • newValues Array

    of new values

  • startFrame Number

    Must be an integer value.

removeAll () public

Remove all keys and values

removeKey
(
  • frame
)

Remove the key at the specified frame

Parameters:
  • frame Number

    Must be an integer value.

sortByFrame () public

Sort the list of keys by frame number

Properties

attribute String

A string representing the attribute to be animated (eg: "position.x", "rotation.angle", "fill", ...)

listValues Array

list of the [frame, value] pairs for the animation the index of the list begins at 0, not at the first key frame

onAnimate Function

Callback on animation event

onAnimationEnd Function

Callback on animation end event

onAnimationStart Function

Callback on animation start event

parentNode CGSGNode

The animated nodes