# Animation

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

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

```rust
struct Animation
```

Tracks the progress of an animation.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`duration_property`](#function-duration_property)
- [`duration`](#function-duration)
- [`set_duration`](#function-set_duration)
- [`iteration_count_property`](#function-iteration_count_property)
- [`iteration_count`](#function-iteration_count)
- [`set_iteration_count`](#function-set_iteration_count)
- [`playback_direction_property`](#function-playback_direction_property)
- [`playback_direction`](#function-playback_direction)
- [`set_playback_direction`](#function-set_playback_direction)
- [`playback_behavior_property`](#function-playback_behavior_property)
- [`playback_behavior`](#function-playback_behavior)
- [`set_playback_behavior`](#function-set_playback_behavior)
- [`fill_mode_property`](#function-fill_mode_property)
- [`fill_mode`](#function-fill_mode)
- [`set_fill_mode`](#function-set_fill_mode)
- [`delay_property`](#function-delay_property)
- [`delay`](#function-delay)
- [`set_delay`](#function-set_delay)
- [`delay_between_iterations_property`](#function-delay_between_iterations_property)
- [`delay_between_iterations`](#function-delay_between_iterations)
- [`set_delay_between_iterations`](#function-set_delay_between_iterations)
- [`easing_property`](#function-easing_property)
- [`speed_ratio_property`](#function-speed_ratio_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`easing`](#function-easing)
- [`set_easing`](#function-set_easing)
- [`speed_ratio`](#function-speed_ratio)
- [`set_speed_ratio`](#function-set_speed_ratio)
- [`children`](#function-children)
- [`apply`](#function-apply)
- [`apply_for_preview`](#function-apply_for_preview)
- [`run_async`](#function-run_async)
- [`run_async_with_clock`](#function-run_async_with_clock)
- [`set_animator`](#function-set_animator)
- [`register_custom_animator`](#function-register_custom_animator)

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

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

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

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<Animation>
```

Returns a strong reference to this object.

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

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

### duration_property

```rust
fn duration_property() -> &'static DirectProperty<Animation, SignedDuration>
```

Defines the `Duration` property: the active time of one iteration.

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

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

### duration

```rust
fn duration(self: &Self) -> SignedDuration
```



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

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

### set_duration

```rust
fn set_duration(self: &Self, value: SignedDuration)
```



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

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

### iteration_count_property

```rust
fn iteration_count_property() -> &'static DirectProperty<Animation, IterationCount>
```

Defines the `IterationCount` property: the repeat count.

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

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

### iteration_count

```rust
fn iteration_count(self: &Self) -> IterationCount
```



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

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

### set_iteration_count

```rust
fn set_iteration_count(self: &Self, value: IterationCount)
```



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

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

### playback_direction_property

```rust
fn playback_direction_property() -> &'static DirectProperty<Animation, PlaybackDirection>
```

Defines the `PlaybackDirection` property.

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

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

### playback_direction

```rust
fn playback_direction(self: &Self) -> PlaybackDirection
```



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

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

### set_playback_direction

```rust
fn set_playback_direction(self: &Self, value: PlaybackDirection)
```



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

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

### playback_behavior_property

```rust
fn playback_behavior_property() -> &'static DirectProperty<Animation, PlaybackBehavior>
```

Defines the `PlaybackBehavior` property: whether the animation
pauses when its target is not effectively visible.

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

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

### playback_behavior

```rust
fn playback_behavior(self: &Self) -> PlaybackBehavior
```



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

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

### set_playback_behavior

```rust
fn set_playback_behavior(self: &Self, value: PlaybackBehavior)
```



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

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

### fill_mode_property

```rust
fn fill_mode_property() -> &'static DirectProperty<Animation, FillMode>
```

Defines the `FillMode` property: the value fill mode.

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

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

### fill_mode

```rust
fn fill_mode(self: &Self) -> FillMode
```



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

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

### set_fill_mode

```rust
fn set_fill_mode(self: &Self, value: FillMode)
```



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

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

### delay_property

```rust
fn delay_property() -> &'static DirectProperty<Animation, SignedDuration>
```

Defines the `Delay` property: the initial delay time.

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

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

### delay

```rust
fn delay(self: &Self) -> SignedDuration
```



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

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

### set_delay

```rust
fn set_delay(self: &Self, value: SignedDuration)
```



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

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

### delay_between_iterations_property

```rust
fn delay_between_iterations_property() -> &'static DirectProperty<Animation, SignedDuration>
```

Defines the `DelayBetweenIterations` property.

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

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

### delay_between_iterations

```rust
fn delay_between_iterations(self: &Self) -> SignedDuration
```



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

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

### set_delay_between_iterations

```rust
fn set_delay_between_iterations(self: &Self, value: SignedDuration)
```



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

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

### easing_property

```rust
fn easing_property() -> &'static DirectProperty<Animation, Easing>
```

Defines the `Easing` property: the easing function to be used.

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

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

### speed_ratio_property

```rust
fn speed_ratio_property() -> &'static DirectProperty<Animation, f64>
```

Defines the `SpeedRatio` property: the speed multiple.

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

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

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `FerroObject::construct`.

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

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

### new

```rust
fn new() -> Ref<Self>
```



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

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

### easing

```rust
fn easing(self: &Self) -> Easing
```

The easing function to be used for this animation.

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

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

### set_easing

```rust
fn set_easing(self: &Self, value: impl Into<Easing>)
```



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

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

### speed_ratio

```rust
fn speed_ratio(self: &Self) -> f64
```

The speed multiple for this animation.

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

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

### set_speed_ratio

```rust
fn set_speed_ratio(self: &Self, value: f64)
```



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

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

### children

```rust
fn children(self: &Self) -> KeyFrames
```

The children of the animation: its key frames.

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

<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 `control`: it runs while `match_` is true,
on `clock` (or on the control's clock, or on the global clock).
`on_complete` runs when the animation 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/animation.rs#L300)

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

### apply_for_preview

```rust
fn apply_for_preview(self: &Self, control: &Animatable, clock: Option<Rc<dyn IClock>>, on_complete: Option<Rc<dyn Fn() -> ()>>) -> Rc<dyn IDisposable>
```

Applies an isolated snapshot using the framework animators, retaining final fill
and automatically created transforms at animation priority. Disposing the result
restores the control's underlying values and bindings, including after completion.
This is intended for interactive authoring and inspection; ordinary `apply` retains
its application semantics, including committing forward fill to a local value.

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

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

### run_async

```rust
fn run_async(self: &Self, control: &Animatable, cancellation_token: CancellationToken) -> AnimationTask
```

Starts the animation on `control` and returns a task that completes
when it has ended or `cancellation_token` was cancelled.

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

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

### run_async_with_clock

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

`run_async` on an explicit clock.

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

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

### set_animator

```rust
fn set_animator(setter: &Rc<dyn IAnimationSetter>, value: Rc<dyn ICustomAnimator>)
```

Sets the value of the `Animator` attached property for a setter: the
custom animator that animates the setter's property instead of the
one selected by the property's type.

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

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

### register_custom_animator

```rust
fn register_custom_animator<TAnimator: InterpolatingAnimator + Default>()
```

Registers a user-provided animator for properties of its value type.
It takes precedence over the animators registered before it.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Animation>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)

## Availability

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