Communicator.Animation.KeyframeBuffer

 KeyframeBuffer

This class contains a collection of keyframes. A Keyframe consists of a scalar value T, representing the linear time in seconds, and a vector of scalars described by KeyType. Optionally, a Keyframe can also have a vector of tangents described by KeyType, that are used for cubic spline interpolation. Keyframes are stored in the times, values, and tangents arrays. For example, with KeyType of Vec3: times: t0, t1, ... tn values: v0x, v0y, v0z, ... vnx, vny, vnz tangents: in_v0x, in_v0y, in_v0z, out_v0x, out_v0y, out_v0z, ... in_vnx, in_vny, in_vnz, out_vnx, out_vny, out_vnz

Constructors

constructor

  • Creates a new buffer for storing keyframe data.

    Parameters

    • keyType: KeyType

      The type of keyframes that will be stored in the buffer.

    Returns KeyframeBuffer

Properties

keyOffset

keyOffset: number

The number of elements between successive keyframes in the array.

keyType

keyType: KeyType

tangents

tangents: number[]

times

times: number[]

values

values: number[]

Methods

deleteKeyframe

  • deleteKeyframe(index: number): void
  • Deletes a keyframe at the specified index.

    Parameters

    • index: number

    Returns void

getKeyframeIndex

  • getKeyframeIndex(t: number): number
  • Returns the index of the keyframe at the specified time.

    Parameters

    • t: number

    Returns number

insertQuatKeyframe

  • insertQuatKeyframe(t: number, x: number, y: number, z: number, w: number, inTanX?: number, inTanY?: number, inTanZ?: number, inTanW?: number, outTanX?: number, outTanY?: number, outTanZ?: number, outTanW?: number): void
  • Inserts a Quat keyframe with the specified time. The type of this buffer should be KeyType.Quat

    Parameters

    • t: number
    • x: number
    • y: number
    • z: number
    • w: number
    • Optional inTanX: number
    • Optional inTanY: number
    • Optional inTanZ: number
    • Optional inTanW: number
    • Optional outTanX: number
    • Optional outTanY: number
    • Optional outTanZ: number
    • Optional outTanW: number

    Returns void

    Index at which keyframe was inserted

insertScalarKeyframe

  • insertScalarKeyframe(t: number, val: number, inTan?: number, outTan?: number): number
  • Inserts a Scalar keyframe with the specified time. The type of this buffer should be KeyType.Scalar

    Parameters

    • t: number
    • val: number
    • Optional inTan: number
    • Optional outTan: number

    Returns number

    Index at which keyframe was inserted

insertVec3Keyframe

  • insertVec3Keyframe(t: number, x: number, y: number, z: number, inTanX?: number, inTanY?: number, inTanZ?: number, outTanX?: number, outTanY?: number, outTanZ?: number): number
  • Inserts a Vec3 keyframe with the specified time. The type of this buffer should be KeyType.Vec3

    Parameters

    • t: number
    • x: number
    • y: number
    • z: number
    • Optional inTanX: number
    • Optional inTanY: number
    • Optional inTanZ: number
    • Optional outTanX: number
    • Optional outTanY: number
    • Optional outTanZ: number

    Returns number

    Index at which keyframe was inserted

updateQuatKeyframe

  • updateQuatKeyframe(index: number, t: number, x: number, y: number, z: number, w: number, inTanX?: number, inTanY?: number, inTanZ?: number, inTanW?: number, outTanX?: number, outTanY?: number, outTanZ?: number, outTanW?: number): void
  • Updates a Quat keyframe at the specified index. The type of this buffer should be KeyType.Quat

    Parameters

    • index: number
    • t: number
    • x: number
    • y: number
    • z: number
    • w: number
    • Optional inTanX: number
    • Optional inTanY: number
    • Optional inTanZ: number
    • Optional inTanW: number
    • Optional outTanX: number
    • Optional outTanY: number
    • Optional outTanZ: number
    • Optional outTanW: number

    Returns void

updateScalarKeyframe

  • updateScalarKeyframe(index: number, t: number, val: number, inTan?: number, outTan?: number): void
  • Updates a Scalar keyframe at the specified index. The type of this buffer should be KeyType.Scalar

    Parameters

    • index: number
    • t: number
    • val: number
    • Optional inTan: number
    • Optional outTan: number

    Returns void

updateVec3Keyframe

  • updateVec3Keyframe(index: number, t: number, x: number, y: number, z: number, inTanX?: number, inTanY?: number, inTanZ?: number, outTanX?: number, outTanY?: number, outTanZ?: number): number
  • Updates a Vec3 keyframe at the specified index. The type of this buffer should be KeyType.Vec3

    Parameters

    • index: number
    • t: number
    • x: number
    • y: number
    • z: number
    • Optional inTanX: number
    • Optional inTanY: number
    • Optional inTanZ: number
    • Optional outTanX: number
    • Optional outTanY: number
    • Optional outTanZ: number

    Returns number