Helper class to use for transformation (position, scale or rotation) and morph targets weights animations (can also be used for skin joint matrices animations using only the onAfterUpdate callback).

This class is not made to be used alone but should rather be handled by a TargetsAnimationsManager instance instead.

Constructors

Properties

label: string

Optional label of the KeyframesAnimation.

inputIndex: number

Optional input accessor index defined in the glTF, used to keep different TargetsAnimationsManager in sync if they're using the same input.

keyframes: TypedArray

Keyframes Float32Array of the KeyframesAnimation. Could be omitted when used for a skin joint matrices animation.

values: TypedArray

Values Float32Array of the KeyframesAnimation to use for animation, mapped to the keyframes array. Could be omitted when used for a skin joint matrices animation.

duration: number

Total duration of this animation, i.e. the last keyframes value.

glTF animation path to use, i.e. what component should be animated between 'translation', 'rotation', 'scale' and 'weights'. Could be omitted when used for a skin joint matrices animation.

glTF sampler interpolation to use, i.e. how the animated values should be computed. Default to LINEAR .

weightsBindingInputs: BufferBindingInput[]

Optional BufferBindingInput array to update a weight binding.

onAfterUpdate: () => void

Callback to run after the animated value has been updated. Used for skin joints animations to update joint matrices.

Methods

  • Get a cubic spline interpolation value.

    Parameters

    • t: number

      Current time value to use in the [0, 1] range.

    • prevComponentValue: number

      Previous value to use for interpolation.

    • nextComponentValue: number

      Next value to use for interpolation.

    • prevOutputTangentValue: number

      Previous output tangent value to use for interpolation.

    • nextInputTangentValue: number

      Previous output tangent value to use for interpolation.

    Returns number

  • Get the index from which to return a value from the values array based on an index in the keyframes array and the size of the component to animate.

    Parameters

    • index: number = 0

      Index in the keyframes array to use.

    • size: number = 1

      Size of the component to animate in the values array.

    Returns number