.. role:: ts-api-decorator

#########
Animation
#########

.. container:: ts-api-section

   .. js:module:: Animation




.. toctree::
   :titlesonly:
   :hidden:

   /api_ref/viewing/classes/Animation.Animation
   /api_ref/viewing/classes/Animation.BatchedCameraValues
   /api_ref/viewing/classes/Animation.BatchedNodeValues
   /api_ref/viewing/classes/Animation.BatchedValues
   /api_ref/viewing/classes/Animation.CameraChannel
   /api_ref/viewing/enum/Animation.CameraProperty
   /api_ref/viewing/interfaces/Animation.ColorPosition
   /api_ref/viewing/classes/Animation.ExportContext
   /api_ref/viewing/classes/Animation.ImportContext
   /api_ref/viewing/classes/Animation.IndexedSet
   /api_ref/viewing/enum/Animation.InterpolationType
   /api_ref/viewing/classes/Animation.KeyframeBuffer
   /api_ref/viewing/enum/Animation.KeyType
   /api_ref/viewing/classes/Animation.Manager
   /api_ref/viewing/classes/Animation.NodeChannel
   /api_ref/viewing/enum/Animation.NodeProperty
   /api_ref/viewing/classes/Animation.NodeValues
   /api_ref/viewing/enum/Animation.NodeValuesFlags
   /api_ref/viewing/classes/Animation.Player
   /api_ref/viewing/enum/Animation.PlayerState
   /api_ref/viewing/classes/Animation.Sampler

.. container:: api-index-section

   .. rubric:: Enumerations

   .. rst-class:: api-index-list-item api-kind-enum api-parent-kind-namespace

   * :ref:`Animation.CameraProperty`
   * :ref:`Animation.InterpolationType`
   * :ref:`Animation.KeyType`
   * :ref:`Animation.NodeProperty`
   * :ref:`Animation.NodeValuesFlags`
   * :ref:`Animation.PlayerState`



.. container:: api-index-section

   .. rubric:: Classes

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

   * :js:class:`~Animation.Animation`
   * :js:class:`~Animation.BatchedCameraValues`
   * :js:class:`~Animation.BatchedNodeValues`
   * :js:class:`~Animation.BatchedValues`
   * :js:class:`~Animation.CameraChannel`
   * :js:class:`~Animation.ExportContext`
   * :js:class:`~Animation.ImportContext`
   * :js:class:`~Animation.IndexedSet`
   * :js:class:`~Animation.KeyframeBuffer`
   * :js:class:`~Animation.Manager`
   * :js:class:`~Animation.NodeChannel`
   * :js:class:`~Animation.NodeValues`
   * :js:class:`~Animation.Player`
   * :js:class:`~Animation.Sampler`



.. container:: api-index-section

   .. rubric:: Interfaces

   .. rst-class:: api-index-list-item api-kind-interface api-parent-kind-namespace

   * :js:class:`~Animation.ColorPosition`



.. container:: api-index-section

   .. rubric:: Type Aliases

   .. rst-class:: api-index-list-item api-kind-typealias api-parent-kind-namespace

   * :ref:`Animation.ColorMap`
   * :ref:`Animation.KeyframeIndex`



.. container:: api-index-section

   .. rubric:: Functions

   .. rst-class:: api-index-list-item api-kind-function api-parent-kind-namespace

   * :js:func:`~Animation.createCameraChannels`
   * :js:func:`~Animation.exportAnimations`
   * :js:func:`~Animation.importAnimations`
   * :js:func:`~Animation.keyframeCamera`





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

Type Aliases
============

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

.. _Animation.ColorMap:

ColorMap
--------

RGB color values are specified in the 0-255 range.
Positions are specified in the 0-1 range, pre-sorted in ascending order.

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

.. _Animation.KeyframeIndex:

KeyframeIndex
-------------

Functions
=========

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

createCameraChannels
--------------------

.. js:function:: createCameraChannels( animation, namePrefix, interpolationType)

   :param animation: Animation that will receive the new camera channels.  This animation should not contain any camera channels.
   :type animation: Animation
   :param namePrefix: Prefix to use for channel names.
   :type namePrefix: string
   :param interpolationType: The type of interpolation that will be set on each sampler that is created.
   :type interpolationType: InterpolationType


   Convenience method that sets up Animation channels, samplers, and keyframe buffers for the supplied camera.

   The created channel and buffer names will have the form: <namePrefix>-<Property> where type is the corresponding value of [[CameraProperty]]


   :rtype: [CameraChannel]

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

exportAnimations
----------------

.. js:function:: exportAnimations( animations)

   :param animations: None
   :type animations: [Animation]


   Return the given animations and their dependent data in a form suitable
   for serialization via, e.g., ``JSON.stringify``. The animation objects can
   be recreated by passing the output to [[importAnimations]].

   Sharing of objects such as keyframe buffers and samplers is preserved.

   The layout of the returned data is subject to change in future releases.


   :rtype: object

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

importAnimations
----------------

.. js:function:: importAnimations( exportedObj)

   :param exportedObj: None
   :type exportedObj: object


   Recreate [[Animation]] objects exported by a call to
   [[exportAnimations]].


   :rtype: [Animation]

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

keyframeCamera
--------------

.. js:function:: keyframeCamera( t, camera, animation)

   :param t: Animation time (in seconds) that will be used for the created keyframes
   :type t: number
   :param camera: Camera containing the current values to keyframe.
   :type camera: Camera
   :param animation: An animation containing camera channels created using [[createChannelsForCamera]]
   :type animation: Animation


   Convenience method that will update keyframe buffers for animation channels created with [[createChannelsForCamera]].


   :rtype: void

