# Animator

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

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

```rust
trait Animator: Sized + 'static
```

Base class for animators: interpolates the key frames of one property of
an animation.

An animator implements `interpolate` for its value
type; everything else has an implementation that subclasses override
only for special targets (brushes, transforms).

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

## Members

- [`Value`](#assoc_type-value)
- [`base`](#function-base)
- [`interpolate`](#function-interpolate)
- [`typed_value`](#function-typed_value)
- [`validate`](#function-validate)
- [`bind_animation`](#function-bind_animation)
- [`apply`](#function-apply)

<a id="assoc_type-value"></a>

### Value

```rust
type Value: PropertyValue + Default
```

The type of the values the animator produces, which is the value
type of the properties it animates.

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

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

### base

```rust
fn base(self: &Self) -> &AnimatorBase
```

The key frames and the target property.

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

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

### interpolate

```rust
fn interpolate(self: &Self, progress: f64, old_value: &<Self as >::Value, new_value: &<Self as >::Value) -> <Self as >::Value
```

Interpolates between two values using the specified progress.

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

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

### typed_value

```rust
fn typed_value(self: &Self, untyped: &dyn AnyValue) -> Option<<Self as >::Value>
```

Reads a key frame value; `None` when it is not a value this animator
can animate, in which case the neutral value is used in its place.

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

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

### validate

```rust
fn validate(self: &Self, _item: &Ref<AnimatorKeyFrame>)
```

Validates a key frame that is being added. Panics to reject it.

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

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

### bind_animation

```rust
fn bind_animation(self: &Self, control: &Animatable, instance: Rc<dyn IObservable<<Self as >::Value>>) -> Rc<dyn IDisposable>
```

Binds the values a running animation produces to the target property
of the control, at animation priority.

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

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

### apply

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

Applies the animation to `control`: it runs while `match_` is true.

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

## Trait implementations

- [`Animator`](/docs/0.5.0/api/ferroui-base/animation/animators/trait-animator/)

## Availability

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