# KeyframeBuffer

class `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

  ## Index

  Constructors

  - `constructor`

  Properties

  - `keyOffset`
  - `keyType`
  - `tangents`
  - `times`
  - `values`

  Methods

  - `deleteKeyframe`
  - `getKeyframeIndex`
  - `insertQuatKeyframe`
  - `insertScalarKeyframe`
  - `insertVec3Keyframe`
  - `updateQuatKeyframe`
  - `updateScalarKeyframe`
  - `updateVec3Keyframe`

## Constructors

`Animation.KeyframeBuffer.``constructor`()
  KeyframeBuffer(keyType: `KeyType`): `KeyframeBuffer`

  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

`Animation.KeyframeBuffer.``keyOffset`

  readonly

  keyOffset: number

  The number of elements between successive keyframes in the array.

`Animation.KeyframeBuffer.``keyType`

  readonly

  keyType: `KeyType`

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

`Animation.KeyframeBuffer.``tangents`
  tangents: number[]

`Animation.KeyframeBuffer.``times`
  times: number[]

`Animation.KeyframeBuffer.``values`
  values: number[]

## Methods

`Animation.KeyframeBuffer.``deleteKeyframe`()
  deleteKeyframe(index: number): void

  Deletes a keyframe at the specified index.

  Parameters

  > index: number

  Returns: void

`Animation.KeyframeBuffer.``getKeyframeIndex`()
  getKeyframeIndex(t: number): number

  Returns the index of the keyframe at the specified time.

  Parameters

  > t: number

  Returns: number

`Animation.KeyframeBuffer.``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

  > inTanX: number

  > inTanY: number

  > inTanZ: number

  > inTanW: number

  > outTanX: number

  > outTanY: number

  > outTanZ: number

  > outTanW: number

  Returns: void

  > Index at which keyframe was inserted

`Animation.KeyframeBuffer.``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

  > inTan: number

  > outTan: number

  Returns: number

  > Index at which keyframe was inserted

`Animation.KeyframeBuffer.``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

  > inTanX: number

  > inTanY: number

  > inTanZ: number

  > outTanX: number

  > outTanY: number

  > outTanZ: number

  Returns: number

  > Index at which keyframe was inserted

`Animation.KeyframeBuffer.``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

  > inTanX: number

  > inTanY: number

  > inTanZ: number

  > inTanW: number

  > outTanX: number

  > outTanY: number

  > outTanZ: number

  > outTanW: number

  Returns: void

`Animation.KeyframeBuffer.``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

  > inTan: number

  > outTan: number

  Returns: void

`Animation.KeyframeBuffer.``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

  > inTanX: number

  > inTanY: number

  > inTanZ: number

  > outTanX: number

  > outTanY: number

  > outTanZ: number

  Returns: number

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Visualize Web or choose a sample question below to start a conversation:

What is HOOPS Visualize Web?
What are the latest release notes for HOOPS Visualize Web?
How do I start evaluating HOOPS Visualize Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...