# IAnimation

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/animation/trait-ianimation/

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

```rust
trait IAnimation: 'static
```

Interface for animation objects.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/i_animation.rs#L8)

## Members

- [`apply`](#function-apply)
- [`run_async`](#function-run_async)
- [`as_object`](#function-as_object)

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

### apply

```rust
fn apply(self: &Self, control: &Animatable, clock: Option<Rc<dyn IClock>>, match_: Rc<dyn IObservable<bool>>, on_complete: Option<Rc<dyn Fn() -> ()>>, is_manually_started: bool) -> Rc<dyn IDisposable>
```

Applies the animation to the specified control: it runs while
`match_` is true. `on_complete` runs when it ends by itself.
`is_manually_started` tells an animation started by code from one
started by a style. Disposing the result removes the animation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/i_animation.rs#L13)

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

### run_async

```rust
fn run_async(self: &Self, control: &Animatable, clock: Option<Rc<dyn IClock>>, cancellation_token: CancellationToken) -> AnimationTask
```

Runs the animation on the specified control. The result completes
when the animation has ended or was cancelled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/i_animation.rs#L24)

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

### as_object

```rust
fn as_object(self: &Self) -> Option<crate::Ref<crate::FerroObject>>
```

The object of the object model that implements the contract, if one
does: the equivalent of `is`/`as` on the interface. Cast the object to
the class looked for (`as_object()?.cast::<T>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/i_animation.rs#L40)

## Availability

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