# ConnectedAnimationService

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

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

```rust
struct ConnectedAnimationService
```

Coordinates connected animations across views. Each [`TopLevel`](/docs/0.5.0/api/ferroui-controls/struct-toplevel/) window
has its own independent instance so animations cannot bleed across
windows.

Typical usage:

1. On the source view, call `prepare_to_animate`
   to capture the element.
2. Navigate to the destination view.
3. On the destination view, call `get_animation`
   then `try_start` on the returned
   animation to run the animation.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`get_for_top_level`](#function-get_for_top_level)
- [`get_for_current_view`](#function-get_for_current_view)
- [`default_duration`](#function-default_duration)
- [`set_default_duration`](#function-set_default_duration)
- [`default_easing_function`](#function-default_easing_function)
- [`set_default_easing_function`](#function-set_default_easing_function)
- [`prepare_to_animate`](#function-prepare_to_animate)
- [`get_animation`](#function-get_animation)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

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

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<ConnectedAnimationService>
```

Returns a strong reference to this object.

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

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

### get_for_top_level

```rust
fn get_for_top_level(top_level: &TopLevel) -> Ref<ConnectedAnimationService>
```

Gets the `ConnectedAnimationService` for the specified `top_level`.
Each top-level window has its own isolated instance.

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

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

### get_for_current_view

```rust
fn get_for_current_view() -> Ref<ConnectedAnimationService>
```

`GetForCurrentView`: the service of the thread. Animations prepared with it can fly in
any window of the thread (each flight uses the window of its elements).

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

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

### default_duration

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

Gets the default duration applied to all animations whose
configuration does not specify one. Defaults to 300 ms.

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

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

### set_default_duration

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

Sets the default duration applied to all animations whose
configuration does not specify one.

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

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

### default_easing_function

```rust
fn default_easing_function(self: &Self) -> Option<Easing>
```

Gets the default easing function applied when the active
`ConnectedAnimationConfiguration`
does not specify one. When `None` a configuration-specific default
is used.

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

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

### set_default_easing_function

```rust
fn set_default_easing_function(self: &Self, value: Option<Easing>)
```

Sets the default easing function.

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

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

### prepare_to_animate

```rust
fn prepare_to_animate(self: &Self, key: &str, source: &Visual) -> Rc<ConnectedAnimation>
```

Captures `source` and registers a pending animation under `key`. Call
this on the source view *before* navigating away.

`key` is the unique string that pairs this call with the matching
`get_animation` call on the destination view;
`source` is the element to animate from. Returns the prepared
`ConnectedAnimation`.
## Panics

Panics if `key` is empty.

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

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

### get_animation

```rust
fn get_animation(self: &Self, key: &str) -> Option<Rc<ConnectedAnimation>>
```

Retrieves a pending animation registered under `key`. Returns `None`
if no animation exists or if it has already been consumed. Call this
on the destination view *after* navigating, then call
`try_start` on the returned
animation.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `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`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ConnectedAnimationService>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)

## Availability

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