.. role:: ts-api-decorator

##############
KeyframeBuffer
##############

.. js:module:: Animation
   :noindex:

.. container:: ts-api-section

   .. js:class:: 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



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Animation.KeyframeBuffer.constructor`



.. container:: api-index-section

   .. rubric:: Properties

   .. rst-class:: api-index-list-item api-kind-property api-parent-kind-class

   * :js:attr:`~Animation.KeyframeBuffer.keyOffset`
   * :js:attr:`~Animation.KeyframeBuffer.keyType`
   * :js:attr:`~Animation.KeyframeBuffer.tangents`
   * :js:attr:`~Animation.KeyframeBuffer.times`
   * :js:attr:`~Animation.KeyframeBuffer.values`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Animation.KeyframeBuffer.deleteKeyframe`
   * :js:meth:`~Animation.KeyframeBuffer.getKeyframeIndex`
   * :js:meth:`~Animation.KeyframeBuffer.insertQuatKeyframe`
   * :js:meth:`~Animation.KeyframeBuffer.insertScalarKeyframe`
   * :js:meth:`~Animation.KeyframeBuffer.insertVec3Keyframe`
   * :js:meth:`~Animation.KeyframeBuffer.updateQuatKeyframe`
   * :js:meth:`~Animation.KeyframeBuffer.updateScalarKeyframe`
   * :js:meth:`~Animation.KeyframeBuffer.updateVec3Keyframe`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: KeyframeBuffer.constructor( keyType)

      :param keyType: The type of keyframes that will be stored in the buffer.
      :type keyType: KeyType


      Creates a new buffer for storing keyframe data.


      :rtype: KeyframeBuffer



Properties
==========

.. container:: ts-api-section

   .. js:attribute:: KeyframeBuffer.keyOffset

      :type: number

      The number of elements between successive keyframes in the array.



.. container:: ts-api-section

   .. js:attribute:: KeyframeBuffer.keyType

      :type: KeyType

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



.. container:: ts-api-section

   .. js:attribute:: KeyframeBuffer.tangents

      :type: [number]





.. container:: ts-api-section

   .. js:attribute:: KeyframeBuffer.times

      :type: [number]





.. container:: ts-api-section

   .. js:attribute:: KeyframeBuffer.values

      :type: [number]





Methods
=======

.. rst-class:: ts-api-section

deleteKeyframe
--------------

.. js:method:: KeyframeBuffer.deleteKeyframe( index)

   :param index: None
   :type index: number


   Deletes a keyframe at the specified index.


   :rtype: void

.. rst-class:: ts-api-section

getKeyframeIndex
----------------

.. js:method:: KeyframeBuffer.getKeyframeIndex( t)

   :param t: None
   :type t: number


   Returns the index of the keyframe at the specified time.


   :rtype: number

.. rst-class:: ts-api-section

insertQuatKeyframe
------------------

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

   :param t: None
   :type t: number
   :param x: None
   :type x: number
   :param y: None
   :type y: number
   :param z: None
   :type z: number
   :param w: None
   :type w: number
   :param inTanX: :ts-api-decorator:`optional` None
   :type inTanX: number
   :param inTanY: :ts-api-decorator:`optional` None
   :type inTanY: number
   :param inTanZ: :ts-api-decorator:`optional` None
   :type inTanZ: number
   :param inTanW: :ts-api-decorator:`optional` None
   :type inTanW: number
   :param outTanX: :ts-api-decorator:`optional` None
   :type outTanX: number
   :param outTanY: :ts-api-decorator:`optional` None
   :type outTanY: number
   :param outTanZ: :ts-api-decorator:`optional` None
   :type outTanZ: number
   :param outTanW: :ts-api-decorator:`optional` None
   :type outTanW: number


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

   :returns: Index at which keyframe was inserted


   :rtype: void

.. rst-class:: ts-api-section

insertScalarKeyframe
--------------------

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

   :param t: None
   :type t: number
   :param val: None
   :type val: number
   :param inTan: :ts-api-decorator:`optional` None
   :type inTan: number
   :param outTan: :ts-api-decorator:`optional` None
   :type outTan: number


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

   :returns: Index at which keyframe was inserted


   :rtype: number

.. rst-class:: ts-api-section

insertVec3Keyframe
------------------

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

   :param t: None
   :type t: number
   :param x: None
   :type x: number
   :param y: None
   :type y: number
   :param z: None
   :type z: number
   :param inTanX: :ts-api-decorator:`optional` None
   :type inTanX: number
   :param inTanY: :ts-api-decorator:`optional` None
   :type inTanY: number
   :param inTanZ: :ts-api-decorator:`optional` None
   :type inTanZ: number
   :param outTanX: :ts-api-decorator:`optional` None
   :type outTanX: number
   :param outTanY: :ts-api-decorator:`optional` None
   :type outTanY: number
   :param outTanZ: :ts-api-decorator:`optional` None
   :type outTanZ: number


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

   :returns: Index at which keyframe was inserted


   :rtype: number

.. rst-class:: ts-api-section

updateQuatKeyframe
------------------

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

   :param index: None
   :type index: number
   :param t: None
   :type t: number
   :param x: None
   :type x: number
   :param y: None
   :type y: number
   :param z: None
   :type z: number
   :param w: None
   :type w: number
   :param inTanX: :ts-api-decorator:`optional` None
   :type inTanX: number
   :param inTanY: :ts-api-decorator:`optional` None
   :type inTanY: number
   :param inTanZ: :ts-api-decorator:`optional` None
   :type inTanZ: number
   :param inTanW: :ts-api-decorator:`optional` None
   :type inTanW: number
   :param outTanX: :ts-api-decorator:`optional` None
   :type outTanX: number
   :param outTanY: :ts-api-decorator:`optional` None
   :type outTanY: number
   :param outTanZ: :ts-api-decorator:`optional` None
   :type outTanZ: number
   :param outTanW: :ts-api-decorator:`optional` None
   :type outTanW: number


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


   :rtype: void

.. rst-class:: ts-api-section

updateScalarKeyframe
--------------------

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

   :param index: None
   :type index: number
   :param t: None
   :type t: number
   :param val: None
   :type val: number
   :param inTan: :ts-api-decorator:`optional` None
   :type inTan: number
   :param outTan: :ts-api-decorator:`optional` None
   :type outTan: number


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


   :rtype: void

.. rst-class:: ts-api-section

updateVec3Keyframe
------------------

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

   :param index: None
   :type index: number
   :param t: None
   :type t: number
   :param x: None
   :type x: number
   :param y: None
   :type y: number
   :param z: None
   :type z: number
   :param inTanX: :ts-api-decorator:`optional` None
   :type inTanX: number
   :param inTanY: :ts-api-decorator:`optional` None
   :type inTanY: number
   :param inTanZ: :ts-api-decorator:`optional` None
   :type inTanZ: number
   :param outTanX: :ts-api-decorator:`optional` None
   :type outTanX: number
   :param outTanY: :ts-api-decorator:`optional` None
   :type outTanY: number
   :param outTanZ: :ts-api-decorator:`optional` None
   :type outTanZ: number


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


   :rtype: number

