# AnimationController

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/animations/struct-animationcontroller/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct AnimationController
```

Controls running animations: pauses and resumes them, moves them to a
point (`Progress`) and changes their speed (`PlaybackRate`) (WinUI
`AnimationController`).

An animation comes under a controller when it is started with
`start_animation_with_controller`,
or through `try_get_animation_controller`
of the object it animates. Key frame and natural motion animations can be
controlled; expression animations are not affected. One controller can
control several animations.

`Progress` and `PlaybackRate` can be animated
(`controller.start_animation("Progress", expression)`), and the controller
can be a reference parameter of an expression (`controller.Progress`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L78)

## Members

- [`MAX_PLAYBACK_RATE`](#assoc_const-max_playback_rate)
- [`MIN_PLAYBACK_RATE`](#assoc_const-min_playback_rate)
- [`compositor`](#function-compositor)
- [`pause`](#function-pause)
- [`resume`](#function-resume)
- [`is_paused`](#function-is_paused)
- [`playback_rate`](#function-playback_rate)
- [`set_playback_rate`](#function-set_playback_rate)
- [`progress`](#function-progress)
- [`set_progress`](#function-set_progress)
- [`progress_behavior`](#function-progress_behavior)
- [`set_progress_behavior`](#function-set_progress_behavior)

<a id="assoc_const-max_playback_rate"></a>

### MAX_PLAYBACK_RATE

```rust
const MAX_PLAYBACK_RATE: f32
```

The highest playback rate (WinUI `MaxPlaybackRate`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L85)

<a id="assoc_const-min_playback_rate"></a>

### MIN_PLAYBACK_RATE

```rust
const MIN_PLAYBACK_RATE: f32
```

The lowest playback rate (WinUI `MinPlaybackRate`); a negative rate
plays backwards.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L88)

<a id="function-compositor"></a>

### compositor

```rust
fn compositor(self: &Self) -> &Rc<Compositor>
```

The compositor of the controller.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L101)

<a id="function-pause"></a>

### pause

```rust
fn pause(self: &Self)
```

Pauses the controlled animations: their time stops, and they do not end
while paused.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L107)

<a id="function-resume"></a>

### resume

```rust
fn resume(self: &Self)
```

Resumes the controlled animations from where they were paused.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L112)

<a id="function-is_paused"></a>

### is_paused

```rust
fn is_paused(self: &Self) -> bool
```

Whether the controller is paused (not a WinUI member).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L117)

<a id="function-playback_rate"></a>

### playback_rate

```rust
fn playback_rate(self: &Self) -> f32
```

The speed of the controlled animations: 1 is normal speed, 2 twice as
fast, a negative rate plays backwards.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L123)

<a id="function-set_playback_rate"></a>

### set_playback_rate

```rust
fn set_playback_rate(self: &Self, value: f32)
```

Sets the playback rate, clamped to
`MIN_PLAYBACK_RATE`..`MAX_PLAYBACK_RATE`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L129)

<a id="function-progress"></a>

### progress

```rust
fn progress(self: &Self) -> f32
```

The progress last assigned (0..1).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L139)

<a id="function-set_progress"></a>

### set_progress

```rust
fn set_progress(self: &Self, value: f32)
```

Moves the controlled animations to a point between their start (0)
and their end (1), clamped to that range. A playing animation goes on
from there; a paused one stays there.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L146)

<a id="function-progress_behavior"></a>

### progress_behavior

```rust
fn progress_behavior(self: &Self) -> AnimationControllerProgressBehavior
```

What the progress covers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L154)

<a id="function-set_progress_behavior"></a>

### set_progress_behavior

```rust
fn set_progress_behavior(self: &Self, value: AnimationControllerProgressBehavior)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/animation_controller.rs#L161)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)
- [`ICompositionObjectAnimations`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-icompositionobjectanimations/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
