# ConnectedAnimation

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

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

```rust
struct ConnectedAnimation
```

Animates an element seamlessly between two views during navigation by
flying a proxy over the [`OverlayLayer`](/docs/0.5.0/api/ferroui-controls/primitives/struct-overlaylayer/).

Obtain an instance via
`ConnectedAnimationService::prepare_to_animate`, then start it with
`try_start` after navigation.

The animation auto-disposes after three seconds if not consumed
(matching UWP behaviour).

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

## Members

- [`key`](#function-key)
- [`is_consumed`](#function-is_consumed)
- [`configuration`](#function-configuration)
- [`set_configuration`](#function-set_configuration)
- [`completed`](#function-completed)
- [`try_start`](#function-try_start)
- [`try_start_with_coordinated_elements`](#function-try_start_with_coordinated_elements)
- [`cancel`](#function-cancel)
- [`is_scale_animation_enabled`](#function-is_scale_animation_enabled)
- [`set_is_scale_animation_enabled`](#function-set_is_scale_animation_enabled)
- [`set_animation_component`](#function-set_animation_component)
- [`dispose`](#function-dispose)

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

### key

```rust
fn key(self: &Self) -> &str
```

Gets the key that identifies this animation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L210)

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

### is_consumed

```rust
fn is_consumed(self: &Self) -> bool
```

Gets a value indicating whether `try_start` has
been called.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L216)

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

### configuration

```rust
fn configuration(self: &Self) -> Option<Rc<dyn ConnectedAnimationConfiguration>>
```

Gets the configuration that controls timing and visual style.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L221)

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

### set_configuration

```rust
fn set_configuration(self: &Self, value: Option<Rc<dyn ConnectedAnimationConfiguration>>)
```

Sets the configuration that controls timing and visual style. Set
this before calling `try_start`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L227)

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

### completed

```rust
fn completed(self: &Self, handler: impl Fn(&ConnectedAnimationCompletedEventArgs) -> () + 'static) -> Subscription
```

Raised when the animation finishes or is cancelled. Check
`ConnectedAnimationCompletedEventArgs::cancelled` to distinguish the
cases.

Dropping the returned guard removes the handler;
`Subscription::detach` keeps it for the life of the animation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L237)

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

### try_start

```rust
fn try_start(self: &Self, destination: &Visual) -> bool
```

Starts the animation towards `destination`. Returns `false` if the
animation has already been consumed or disposed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L259)

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

### try_start_with_coordinated_elements

```rust
fn try_start_with_coordinated_elements(self: &Self, destination: &Visual, coordinated_elements: &[Ref<Visual>]) -> bool
```

Starts the animation towards `destination` with
`coordinated_elements` that fade in during the last 40 % of the
animation. Returns `false` if the animation has already been consumed
or disposed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L267)

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

### cancel

```rust
fn cancel(self: &Self)
```

`Cancel`: stops the animation and shows the source and destination elements in their
places. As in WinUI no `Completed` is raised; the animation cannot be started any more.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L298)

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

### is_scale_animation_enabled

```rust
fn is_scale_animation_enabled(self: &Self) -> bool
```

`IsScaleAnimationEnabled`: whether the animation scales the image from the size of the
source to that of the destination (`true`, the default), or keeps the sizes and shows
the parts of the elements their clips leave visible.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L310)

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

### set_is_scale_animation_enabled

```rust
fn set_is_scale_animation_enabled(self: &Self, value: bool)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L317)

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

### set_animation_component

```rust
fn set_animation_component(self: &Self, component: ConnectedAnimationComponent, animation: Option<Rc<dyn ICompositionAnimation>>)
```

`SetAnimationComponent`: replaces the animation of one part of the flight. The animation
receives the scalar parameters `StartingValue` and `FinalValue`, and is started on the
component (for `OffsetX`, `Offset.X` of the flight). `None` restores the default.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L327)

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

### dispose

```rust
fn dispose(self: &Self)
```

Releases all resources and cancels the animation if it is in flight.
The `completed` event is raised with `cancelled`
set only when the animation was actively running at dispose time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/animation/connected_animation.rs#L362)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `PartialEq`

## Availability

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