KeyframeBuffer

class Communicator.Animation.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


Constructors

KeyframeBuffer.constructor(keyType)

Creates a new buffer for storing keyframe data.

Arguments
Return type

KeyframeBuffer()

Properties

KeyframeBuffer.keyOffset
Type

number

The number of elements between successive keyframes in the array.

KeyframeBuffer.keyType
Type

KeyType

KeyframeBuffer.tangents
Type

[number]

KeyframeBuffer.times
Type

[number]

KeyframeBuffer.values
Type

[number]

Methods

deleteKeyframe

KeyframeBuffer.deleteKeyframe(index)

Deletes a keyframe at the specified index.

Arguments
  • index (number()) –

Return type

void

getKeyframeIndex

KeyframeBuffer.getKeyframeIndex(t)

Returns the index of the keyframe at the specified time.

Arguments
  • t (number()) –

Return type

number

insertQuatKeyframe

KeyframeBuffer.insertQuatKeyframe(t, x, y, z, w[, inTanX[, inTanY[, inTanZ[, inTanW[, outTanX[, outTanY[, outTanZ[, outTanW]]]]]]]])

Inserts a Quat keyframe with the specified time. The type of this buffer should be KeyType.Quat

Arguments
  • t (number()) –

  • x (number()) –

  • y (number()) –

  • z (number()) –

  • w (number()) –

  • inTanX (number()) – optional

  • inTanY (number()) – optional

  • inTanZ (number()) – optional

  • inTanW (number()) – optional

  • outTanX (number()) – optional

  • outTanY (number()) – optional

  • outTanZ (number()) – optional

  • outTanW (number()) – optional

Return type

void

Returns

Index at which keyframe was inserted

insertScalarKeyframe

KeyframeBuffer.insertScalarKeyframe(t, val[, inTan[, outTan]])

Inserts a Scalar keyframe with the specified time. The type of this buffer should be KeyType.Scalar

Arguments
  • t (number()) –

  • val (number()) –

  • inTan (number()) – optional

  • outTan (number()) – optional

Return type

number

Returns

Index at which keyframe was inserted

insertVec3Keyframe

KeyframeBuffer.insertVec3Keyframe(t, x, y, z[, inTanX[, inTanY[, inTanZ[, outTanX[, outTanY[, outTanZ]]]]]])

Inserts a Vec3 keyframe with the specified time. The type of this buffer should be [[KeyType.Vec3]]

Arguments
  • t (number()) –

  • x (number()) –

  • y (number()) –

  • z (number()) –

  • inTanX (number()) – optional

  • inTanY (number()) – optional

  • inTanZ (number()) – optional

  • outTanX (number()) – optional

  • outTanY (number()) – optional

  • outTanZ (number()) – optional

Return type

number

Returns

Index at which keyframe was inserted

updateQuatKeyframe

KeyframeBuffer.updateQuatKeyframe(index, t, x, y, z, w[, inTanX[, inTanY[, inTanZ[, inTanW[, outTanX[, outTanY[, outTanZ[, outTanW]]]]]]]])

Updates a Quat keyframe at the specified index. The type of this buffer should be KeyType.Quat

Arguments
  • index (number()) –

  • t (number()) –

  • x (number()) –

  • y (number()) –

  • z (number()) –

  • w (number()) –

  • inTanX (number()) – optional

  • inTanY (number()) – optional

  • inTanZ (number()) – optional

  • inTanW (number()) – optional

  • outTanX (number()) – optional

  • outTanY (number()) – optional

  • outTanZ (number()) – optional

  • outTanW (number()) – optional

Return type

void

updateScalarKeyframe

KeyframeBuffer.updateScalarKeyframe(index, t, val[, inTan[, outTan]])

Updates a Scalar keyframe at the specified index. The type of this buffer should be KeyType.Scalar

Arguments
  • index (number()) –

  • t (number()) –

  • val (number()) –

  • inTan (number()) – optional

  • outTan (number()) – optional

Return type

void

updateVec3Keyframe

KeyframeBuffer.updateVec3Keyframe(index, t, x, y, z[, inTanX[, inTanY[, inTanZ[, outTanX[, outTanY[, outTanZ]]]]]])

Updates a Vec3 keyframe at the specified index. The type of this buffer should be [[KeyType.Vec3]]

Arguments
  • index (number()) –

  • t (number()) –

  • x (number()) –

  • y (number()) –

  • z (number()) –

  • inTanX (number()) – optional

  • inTanY (number()) – optional

  • inTanZ (number()) – optional

  • outTanX (number()) – optional

  • outTanY (number()) – optional

  • outTanZ (number()) – optional

Return type

number