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

.. role:: clio-static
   :class: clio-flag clio-flag-static


######
Player
######

.. js:class:: Animation.Player

   
   Index
   =====
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~Animation.Player.animation`
   * :js:data:`~Animation.Player.loop`
   * :js:data:`~Animation.Player.nodeIdOffset`
   * :js:data:`~Animation.Player.onComplete`
   * :js:data:`~Animation.Player.speed`
   * :js:data:`~Animation.Player.LoopIndefinitely`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~Animation.Player.evaluate`
   * :js:meth:`~Animation.Player.getAnimationTime`
   * :js:meth:`~Animation.Player.getCurrentTime`
   * :js:meth:`~Animation.Player.getState`
   * :js:meth:`~Animation.Player.pause`
   * :js:meth:`~Animation.Player.play`
   * :js:meth:`~Animation.Player.reload`
   * :js:meth:`~Animation.Player.setChannelEnabled`
   * :js:meth:`~Animation.Player.setTime`
   * :js:meth:`~Animation.Player.stop`
   
   




Properties
==========

.. js:data:: Animation.Player.animation

   .. rst-class:: clio-flags
   
      :clio-readonly:`readonly`
   
   .. rst-class:: sig-pretty-signature
   
      | animation: :js:class:`Animation <Animation.Animation>`
   
   The animation played by this player
   



.. js:data:: Animation.Player.loop

   .. rst-class:: sig-pretty-signature
   
      | loop: *number*
   
   The number of times the animation will repeat. Set to [[LoopIndefinitely]] to repeat indefinitely. Default is 0
   



.. js:data:: Animation.Player.nodeIdOffset

   .. rst-class:: sig-pretty-signature
   
      | nodeIdOffset: *number*
   
   A base offset value which will be applied to all node identifiers in the animation attached to this player. This is useful to play an authored animation for a model that has been loaded into the scene after initial startup. In this situation the authored node identifiers in the animation may not match up with the runtime node identifiers in the current scene. The [[Model.getNodeIdOffset]] function can be used on the loaded model's root node to retrieve the correct offset value.
   



.. js:data:: Animation.Player.onComplete

   .. rst-class:: sig-pretty-signature
   
      | onComplete: (*None* \| () => *void*\ )
   
   Callback function to be called when the animation is complete.  Will not be triggered if the player is looping.
   



.. js:data:: Animation.Player.speed

   .. rst-class:: sig-pretty-signature
   
      | speed: *number*
   
   Scale value to be applied to animation time.
   



.. js:data:: Animation.Player.LoopIndefinitely

   .. rst-class:: clio-flags
   
      :clio-static:`static`
      :clio-readonly:`readonly`
   
   .. rst-class:: sig-pretty-signature
   
      | LoopIndefinitely: *-1*
   
   If loop is set to LoopIndefinitely, the animation will play repeatedly.
   





Methods
=======

.. js:method:: Animation.Player.evaluate

   .. rst-class:: sig-pretty-signature
   
      | evaluate(**time**\ : *number*\ , **out**\ : :js:class:`BatchedValues <Animation.BatchedValues>`\ ): :js:class:`BatchedValues <Animation.BatchedValues>`
   
   Calculate the values for each channel of the associated [[Animation]] at the given time.
   
   **Parameters**
   
      **time**\ : *number*
   
         The time at which to evaluate the animation.
   
   
      **out**\ : :js:class:`BatchedValues <Animation.BatchedValues>`
   
         Storage for the evaluated values. If supplied, this object will be returned instead of a new [[BatchedValues]] object. This allows values gathered from multiple players to be combined into one batch.
   
   
   
   **Returns**\ : :js:class:`BatchedValues <Animation.BatchedValues>`
   



.. js:method:: Animation.Player.getAnimationTime

   .. rst-class:: sig-pretty-signature
   
      | getAnimationTime(): *number*
   
   Gets the current time in seconds of the entire animation.
   
   **Returns**\ : *number*
   



.. js:method:: Animation.Player.getCurrentTime

   .. rst-class:: sig-pretty-signature
   
      | getCurrentTime(): *number*
   
   Gets the current time in seconds that the animation has been playing.
   
   **Returns**\ : *number*
   



.. js:method:: Animation.Player.getState

   .. rst-class:: sig-pretty-signature
   
      | getState(): :js:data:`PlayerState <Animation.PlayerState>`
   
   Gets the current animation state.
   
   **Returns**\ : :js:data:`PlayerState <Animation.PlayerState>`
   



.. js:method:: Animation.Player.pause

   .. rst-class:: sig-pretty-signature
   
      | pause(): *void*
   
   Pauses animation playback.
   
   **Returns**\ : *void*
   



.. js:method:: Animation.Player.play

   .. rst-class:: sig-pretty-signature
   
      | play(): *void*
   
   Starts playing the animation.
   
   **Returns**\ : *void*
   



.. js:method:: Animation.Player.reload

   .. rst-class:: sig-pretty-signature
   
      | reload(): *void*
   
   Updates internal state of animation player.
   
   Call this method after any part of the underlying animation has been updated.
   
   **Returns**\ : *void*
   



.. js:method:: Animation.Player.setChannelEnabled

   .. rst-class:: sig-pretty-signature
   
      | setChannelEnabled(**channel**\ : (:js:class:`NodeChannel <Animation.NodeChannel>` \| :js:class:`CameraChannel <Animation.CameraChannel>`\ ), **enabled**\ : *boolean*\ ): *void*
   
   Sets the enabled state for a channel in this players animation. All channels are enabled by default when a player is created. A channel that has been disabled will not have its value interpolated by the system until it is re-enabled
   
   **Parameters**
   
      **channel**\ : (:js:class:`NodeChannel <Animation.NodeChannel>` \| :js:class:`CameraChannel <Animation.CameraChannel>`\ )
   
         a channel from the underlying animation
   
   
      **enabled**\ : *boolean*
   
         boolean value indicating whether the channel should be enabled.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Animation.Player.setTime

   .. rst-class:: sig-pretty-signature
   
      | setTime(**time**\ : *number*\ ): *void*
   
   Sets the current animation time.
   
   **Parameters**
   
      **time**\ : *number*
   
         time in milliseconds
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Animation.Player.stop

   .. rst-class:: sig-pretty-signature
   
      | stop(): *void*
   
   Stops animation playback and resets the current time to 0.
   
   **Returns**\ : *void*
   





