# ExpressionAnimation

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

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

```rust
struct ExpressionAnimation
```

A Composition Animation that uses a mathematical equation to calculate the value for an animating property every frame.

The core of ExpressionAnimations allows a developer to define a mathematical equation that can be used to calculate the value
of a targeted animating property each frame.
This contrasts `KeyFrameAnimation`s, which use an interpolator to define how the animating
property changes over time. The mathematical equation can be defined using references to properties
of Composition objects, mathematical functions and operators and Input.
Use the `start_animation` method of a composition object to start the animation.

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

## Members

- [`expression`](#function-expression)
- [`set_expression`](#function-set_expression)

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

### expression

```rust
fn expression(self: &Self) -> Option<String>
```

The mathematical equation specifying how the animated value is calculated each frame.
The Expression is the core of an `ExpressionAnimation` and represents the equation
the system will use to calculate the value of the animation property each frame.
The equation is set on this property in the form of a string.
Although expressions can be defined by simple mathematical equations such as "2+2",
the real power lies in creating mathematical relationships where the input values can change frame over frame.

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

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

### set_expression

```rust
fn set_expression(self: &Self, value: Option<String>)
```



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

## 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`
- `ICompositionAnimationBase`
- `ICompositionAnimation`
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)

## Availability

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