# KeyFrameAnimation

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

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

```rust
struct KeyFrameAnimation
```

A time-based animation with one or more key frames.
These frames are markers, allowing developers to specify values at specific times for the animating property.
KeyFrame animations can be further customized by specifying how the animation interpolates between keyframes.

The classes for the value types (`ScalarKeyFrameAnimation`,
`Vector3KeyFrameAnimation`, ...) embed it and dereference to it; they are
expanded from the key frame animations of the composition schema at the
end of this module.

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

## Members

- [`delay_behavior`](#function-delay_behavior)
- [`set_delay_behavior`](#function-set_delay_behavior)
- [`delay_time`](#function-delay_time)
- [`set_delay_time`](#function-set_delay_time)
- [`direction`](#function-direction)
- [`set_direction`](#function-set_direction)
- [`duration`](#function-duration)
- [`set_duration`](#function-set_duration)
- [`iteration_behavior`](#function-iteration_behavior)
- [`set_iteration_behavior`](#function-set_iteration_behavior)
- [`iteration_count`](#function-iteration_count)
- [`set_iteration_count`](#function-set_iteration_count)
- [`stop_behavior`](#function-stop_behavior)
- [`set_stop_behavior`](#function-set_stop_behavior)
- [`key_frame_count`](#function-key_frame_count)
- [`insert_expression_key_frame`](#function-insert_expression_key_frame)

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

### delay_behavior

```rust
fn delay_behavior(self: &Self) -> AnimationDelayBehavior
```

The delay behavior of the key frame animation.

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

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

### set_delay_behavior

```rust
fn set_delay_behavior(self: &Self, value: AnimationDelayBehavior)
```



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

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

### delay_time

```rust
fn delay_time(self: &Self) -> Duration
```

Delay before the animation starts after `start_animation` is called.

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

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

### set_delay_time

```rust
fn set_delay_time(self: &Self, value: Duration)
```



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

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

### direction

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

The direction the animation is playing.
The Direction property allows you to drive your animation from start to end or end to start or alternate
between start and end or end to start if animation has an `iteration_count` greater than one.
This gives an easy way for customizing animation definitions.

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

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

### set_direction

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



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

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

### duration

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

The duration of the animation.
Minimum allowed value is 1ms and maximum allowed value is 24 days.

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

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

### set_duration

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

Sets the duration. As upstream, the range check is made on the
current value rather than on the new one.

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

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

### iteration_behavior

```rust
fn iteration_behavior(self: &Self) -> AnimationIterationBehavior
```

The iteration behavior for the key frame animation.

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

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

### set_iteration_behavior

```rust
fn set_iteration_behavior(self: &Self, value: AnimationIterationBehavior)
```



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

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

### iteration_count

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

The number of times to repeat the key frame animation.

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

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

### set_iteration_count

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



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

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

### stop_behavior

```rust
fn stop_behavior(self: &Self) -> AnimationStopBehavior
```

Specifies how to set the property value when animation is stopped

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

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

### set_stop_behavior

```rust
fn set_stop_behavior(self: &Self, value: AnimationStopBehavior)
```



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

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

### key_frame_count

```rust
fn key_frame_count(self: &Self) -> i32
```

The number of key frames in the animation (WinUI `KeyFrameCount`).

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

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

### insert_expression_key_frame

```rust
fn insert_expression_key_frame(self: &Self, normalized_progress_key: f32, value: &str, easing_function: Option<Easing>)
```

Inserts an expression keyframe.

`normalized_progress_key` is the time the key frame should occur at,
expressed as a percentage of the animation Duration. Allowed value
is from 0.0 to 1.0. `value` is the expression used to calculate the
value of the key frame. `easing_function` is the easing function to
use when interpolating between frames; the default easing of the
compositor when `None`.

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

## 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>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`

## Availability

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