# AnimationRunner

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-behaviors-animations/struct-animationrunner/

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

```rust
struct AnimationRunner
```

Builds and runs animations independently of behaviors, actions, and triggers.

The `Task` of the reference is the `AnimationTask` of the run.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L11)

## Members

- [`run_async`](#function-run_async)
- [`try_run`](#function-try_run)
- [`try_run_async`](#function-try_run_async)
- [`try_build_and_run`](#function-try_build_and_run)
- [`try_build_and_run_async`](#function-try_build_and_run_async)

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

### run_async

```rust
fn run_async(animation: &Animation, target: &Animatable) -> AnimationTask
```

Runs an animation on an animatable target. Returns a task that completes when the
animation finishes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L16)

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

### try_run

```rust
fn try_run(animation: Option<&Animation>, target: Option<&Animatable>) -> bool
```

Starts an animation when both the animation and target are available. Returns `true` when
the animation was started; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L22)

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

### try_run_async

```rust
fn try_run_async(animation: Option<&Animation>, target: Option<&Animatable>) -> Option<AnimationTask>
```

Starts an animation when both the animation and target are available and returns its
completion task, or `None` when the animation could not be started.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L28)

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

### try_build_and_run

```rust
fn try_build_and_run(control: Option<&Control>, animation: Option<&Animation>, animation_builder: Option<&dyn IAnimationBuilder>) -> bool
```

Selects an explicit animation or builds one and starts it on a control: `animation` is
the preferred animation, `animation_builder` the fallback animation builder. Returns
`true` when an animation was started; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L38)

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

### try_build_and_run_async

```rust
fn try_build_and_run_async(control: Option<&Control>, animation: Option<&Animation>, animation_builder: Option<&dyn IAnimationBuilder>) -> Option<AnimationTask>
```

Selects an explicit animation or builds one, starts it on a control, and returns its
completion task, or `None` when no animation could be started.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/animations/animation_runner.rs#L48)

## Trait implementations

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

## Availability

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