API Docs for: v2.1.0
Show:

CGSGTimeline Class

Methods

_computeNumberOfFrameBetweenKeys

() 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:

compute

() public

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

exportValues

() Array

Return the precomputed array of values for this timeline

Returns:

getFirstKey

() CGSGKeyFrame

Returns:

CGSGKeyFrame:

the first key frame of this timeline

getLastKey

() CGSGKeyFrame

Returns:

CGSGKeyFrame:

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
)
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:

:

Object with 2 properties : frame and value, or undefined If no key is defined, return undefined If there is only one key, returns it's value If the frame is before the first key, returns the first key value If the frame is after the last key, returns 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.

removeKeysBetween

(
  • frame1
  • frame2
)

Parameters:

sortByFrame

() public

Sort the list of keys by frame number

Properties

_method

CGSGInterpolator private

Default: {CGSGInterpolatorLinear} CGSGAnimationMethod.LINEAR

attribute

String

A string representing the attribute to be animated (eg: "position.x", "rotation.angle", "color.g", ...) The attribute must be a numeric property

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