# CrossFade

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

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

```rust
struct CrossFade
```

Defines a cross-fade animation between two visuals.

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

## Members

- [`new`](#function-new)
- [`with_duration`](#function-with_duration)
- [`duration`](#function-duration)
- [`set_duration`](#function-set_duration)
- [`fade_in_easing`](#function-fade_in_easing)
- [`set_fade_in_easing`](#function-set_fade_in_easing)
- [`fade_out_easing`](#function-fade_out_easing)
- [`set_fade_out_easing`](#function-set_fade_out_easing)
- [`fill_mode`](#function-fill_mode)
- [`set_fill_mode`](#function-set_fill_mode)
- [`start_cross_fade`](#function-start_cross_fade)

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

### new

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

Creates a cross-fade with a zero duration.

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

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

### with_duration

```rust
fn with_duration(duration: SignedDuration) -> Self
```

Creates a cross-fade with the given duration.

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

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

### duration

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

The duration of the animation.

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

<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/cross_fade.rs#L58)

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

### fade_in_easing

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

The easing function used to fade in.

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

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

### set_fade_in_easing

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



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

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

### fade_out_easing

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

The easing function used to fade out.

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

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

### set_fade_out_easing

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



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

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

### fill_mode

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

The fill mode.

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

<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/cross_fade.rs#L86)

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

### start_cross_fade

```rust
fn start_cross_fade(self: &Self, from: Option<&Ref<Visual>>, to: Option<&Ref<Visual>>, cancellation_token: CancellationToken) -> JoinHandle<()>
```

Starts the animation: fades `from` out and `to` in. When it has
ended without being cancelled, `from` is hidden.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Default`
- [`IPageTransition`](/docs/0.5.0/api/ferroui-base/animation/trait-ipagetransition/)
- [`IProgressPageTransition`](/docs/0.5.0/api/ferroui-base/animation/trait-iprogresspagetransition/)
- `PartialEq`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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