# Player

class `Animation.``Player`()

  ## Index

  Properties

  - `animation`
  - `loop`
  - `nodeIdOffset`
  - `onComplete`
  - `speed`
  - `LoopIndefinitely`

  Methods

  - `evaluate`
  - `getAnimationTime`
  - `getCurrentTime`
  - `getState`
  - `pause`
  - `play`
  - `reload`
  - `setChannelEnabled`
  - `setTime`
  - `stop`

## Properties

`Animation.Player.``animation`

  readonly

  animation: `Animation`

  The animation played by this player

`Animation.Player.``loop`
  loop: number

  The number of times the animation will repeat. Set to [[LoopIndefinitely]] to repeat indefinitely. Default is 0

`Animation.Player.``nodeIdOffset`
  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.

`Animation.Player.``onComplete`
  onComplete: (None | () => void)

  Callback function to be called when the animation is complete. Will not be triggered if the player is looping.

`Animation.Player.``speed`
  speed: number

  Scale value to be applied to animation time.

`Animation.Player.``LoopIndefinitely`

  static readonly

  LoopIndefinitely: -1

  If loop is set to LoopIndefinitely, the animation will play repeatedly.

## Methods

`Animation.Player.``evaluate`()
  evaluate(time: number, out: `BatchedValues`): `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: `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: `BatchedValues`

`Animation.Player.``getAnimationTime`()
  getAnimationTime(): number

  Gets the current time in seconds of the entire animation.

  Returns: number

`Animation.Player.``getCurrentTime`()
  getCurrentTime(): number

  Gets the current time in seconds that the animation has been playing.

  Returns: number

`Animation.Player.``getState`()
  getState(): `PlayerState`

  Gets the current animation state.

  Returns: `PlayerState`

`Animation.Player.``pause`()
  pause(): void

  Pauses animation playback.

  Returns: void

`Animation.Player.``play`()
  play(): void

  Starts playing the animation.

  Returns: void

`Animation.Player.``reload`()
  reload(): void

  Updates internal state of animation player.

  Call this method after any part of the underlying animation has been updated.

  Returns: void

`Animation.Player.``setChannelEnabled`()
  setChannelEnabled(channel: (`NodeChannel` | `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: (`NodeChannel` | `CameraChannel`)

  > > a channel from the underlying animation

  > enabled: boolean

  > > boolean value indicating whether the channel should be enabled.

  Returns: void

`Animation.Player.``setTime`()
  setTime(time: number): void

  Sets the current animation time.

  Parameters

  > time: number

  > > time in milliseconds

  Returns: void

`Animation.Player.``stop`()
  stop(): void

  Stops animation playback and resets the current time to 0.

  Returns: void

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...