---
url: https://cri-middleware.github.io/SSPlayerForWeb/api/@spritestudio/ssplayer-pixi-ui/classes/SSUiStateDriver.md
---
# Class: SSUiStateDriver

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:139](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L139)

Plays the section an [SSUiState](../type-aliases/SSUiState.md) calls for on a `player` the host owns.

[show](#show) switches at once and plays the new section from its first
frame, looping; the section that was playing is dropped. Under reduced
motion it holds the section's first frame instead, stopped, so no event
fires — except that `normal`, and the states that fall back to it, play the
`reduced_motion` label's section when the animation has one.

It takes the player's playback over: it selects animations, sets sections
and the loop count, and plays and stops.

## Constructors

### Constructor

> **new SSUiStateDriver**(`player`, `options?`): `SSUiStateDriver`

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:157](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L157)

#### Parameters

##### player

[`SSPlayer`](SSPlayer.md)

##### options?

###### animation?

`string`

###### clips?

`Partial`<`Record`<[`SSUiState`](../type-aliases/SSUiState.md), [`SSUiClip`](../type-aliases/SSUiClip.md)>>

#### Returns

`SSUiStateDriver`

## Properties

### animation

> `readonly` **animation**: `string` | `undefined`

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:145](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L145)

The animation the states' labels are read from. When omitted, the one
the player has selected the first time a state is shown, or else the
pack's first.

***

### clips

> `readonly` **clips**: [`SSUiClips`](../type-aliases/SSUiClips.md)

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:148](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L148)

Per-state replacements for the labels named after the states.

***

### player

> `readonly` **player**: [`SSPlayer`](SSPlayer.md)

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:158](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L158)

## Accessors

### state

#### Get Signature

> **get** **state**(): [`SSUiState`](../type-aliases/SSUiState.md) | `null`

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:166](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L166)

The state last shown, or null before one has been.

##### Returns

[`SSUiState`](../type-aliases/SSUiState.md) | `null`

## Methods

### show()

> **show**(`state`, `reducedMotion?`): `void`

Defined in: [packages/ssplayer-pixi-ui/src/uiState.ts:178](https://github.com/cri-middleware/SSPlayerForWeb/blob/eb9d544908210befb40d3729ed6fde7adc44f61a/packages/ssplayer-pixi-ui/src/uiState.ts#L178)

Shows `state` — or nothing before the player has a pack.

Showing the state already shown, with the same `reducedMotion`, does
nothing while the player still plays the animation it was given, so it
can be called every frame. After the player loads another pack, it shows
the state again.

#### Parameters

##### state

[`SSUiState`](../type-aliases/SSUiState.md)

##### reducedMotion?

`boolean` = `false`

#### Returns

`void`
