.. role:: clio-readonly
   :class: clio-flag clio-flag-readonly


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

.. js: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
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~Animation.KeyframeBuffer.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~Animation.KeyframeBuffer.keyOffset`
   * :js:data:`~Animation.KeyframeBuffer.keyType`
   * :js:data:`~Animation.KeyframeBuffer.tangents`
   * :js:data:`~Animation.KeyframeBuffer.times`
   * :js:data:`~Animation.KeyframeBuffer.values`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :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
============

.. js:method:: Animation.KeyframeBuffer.constructor

   .. rst-class:: sig-pretty-signature
   
      | KeyframeBuffer(**keyType**\ : :js:data:`KeyType <Animation.KeyType>`\ ): :js:class:`KeyframeBuffer <Animation.KeyframeBuffer>`
   
   Creates a new buffer for storing keyframe data.
   
   **Parameters**
   
      **keyType**\ : :js:data:`KeyType <Animation.KeyType>`
   
         The type of keyframes that will be stored in the buffer.
   
   
   
   **Returns**\ : :js:class:`KeyframeBuffer <Animation.KeyframeBuffer>`
   





Properties
==========

.. js:data:: Animation.KeyframeBuffer.keyOffset

   .. rst-class:: clio-flags
   
      :clio-readonly:`readonly`
   
   .. rst-class:: sig-pretty-signature
   
      | keyOffset: *number*
   
   The number of elements between successive keyframes in the array.
   



.. js:data:: Animation.KeyframeBuffer.keyType

   .. rst-class:: clio-flags
   
      :clio-readonly:`readonly`
   
   .. rst-class:: sig-pretty-signature
   
      | keyType: :js:data:`KeyType <Animation.KeyType>`
   
   The type of keyframes that will be stored in the buffer.
   



.. js:data:: Animation.KeyframeBuffer.tangents

   .. rst-class:: sig-pretty-signature
   
      | tangents: *number*\ []
   



.. js:data:: Animation.KeyframeBuffer.times

   .. rst-class:: sig-pretty-signature
   
      | times: *number*\ []
   



.. js:data:: Animation.KeyframeBuffer.values

   .. rst-class:: sig-pretty-signature
   
      | values: *number*\ []
   





Methods
=======

.. js:method:: Animation.KeyframeBuffer.deleteKeyframe

   .. rst-class:: sig-pretty-signature
   
      | deleteKeyframe(**index**\ : *number*\ ): *void*
   
   Deletes a keyframe at the specified index.
   
   **Parameters**
   
      **index**\ : *number*
   
   
   **Returns**\ : *void*
   



.. js:method:: Animation.KeyframeBuffer.getKeyframeIndex

   .. rst-class:: sig-pretty-signature
   
      | getKeyframeIndex(**t**\ : *number*\ ): *number*
   
   Returns the index of the keyframe at the specified time.
   
   **Parameters**
   
      **t**\ : *number*
   
   
   **Returns**\ : *number*
   



.. js:method:: Animation.KeyframeBuffer.insertQuatKeyframe

   .. rst-class:: sig-pretty-signature
   
      | 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
   
   



.. js:method:: Animation.KeyframeBuffer.insertScalarKeyframe

   .. rst-class:: sig-pretty-signature
   
      | 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
   
   



.. js:method:: Animation.KeyframeBuffer.insertVec3Keyframe

   .. rst-class:: sig-pretty-signature
   
      | 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
   
   



.. js:method:: Animation.KeyframeBuffer.updateQuatKeyframe

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: Animation.KeyframeBuffer.updateScalarKeyframe

   .. rst-class:: sig-pretty-signature
   
      | 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*
   



.. js:method:: Animation.KeyframeBuffer.updateVec3Keyframe

   .. rst-class:: sig-pretty-signature
   
      | 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*
   





