# TiltAnimation

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-behaviors-animations/struct-tiltanimation/

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

```rust
struct TiltAnimation
```

Calculates and applies composition-based pointer tilt animations.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L10)

## Members

- [`calculate_orientation`](#function-calculate_orientation)
- [`try_calculate_orientation`](#function-try_calculate_orientation)
- [`apply`](#function-apply)
- [`reset`](#function-reset)
- [`update_center_point`](#function-update_center_point)

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

### calculate_orientation

```rust
fn calculate_orientation(size: Size, pointer_position: Point, tilt_strength: f64) -> Quaternion
```

Calculates a tilt orientation for a pointer position (relative to the target) inside a
target size; `tilt_strength` is the maximum tilt angle in degrees. Returns the calculated
orientation, or identity for an empty size or central position.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L16)

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

### try_calculate_orientation

```rust
fn try_calculate_orientation(size: Size, pointer_position: Point, tilt_strength: f64) -> Option<Quaternion>
```

Tries to calculate a non-neutral tilt orientation for a pointer position inside a target
size. Returns the calculated orientation, or `None` for an empty size or central position.

Deviation (DEVIATIONS.md, Behaviors): the reference returns `bool` with the orientation in
an `out` parameter (the identity when it returns `false`); here the orientation is the
`Some` of the result.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L26)

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

### apply

```rust
fn apply(target: Option<&Control>, pointer_position: Point, tilt_strength: f64) -> bool
```

Applies a tilt animation for a pointer position (relative to the target);
`tilt_strength` is the maximum tilt angle in degrees. Returns `true` when a composition
visual was animated; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L49)

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

### reset

```rust
fn reset(target: Option<&Control>) -> bool
```

Animates a control back to its neutral orientation. Returns `true` when a composition
visual was animated; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L63)

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

### update_center_point

```rust
fn update_center_point(target: Option<&Control>) -> bool
```

Updates a control's composition center point from its current bounds. Returns `true` when
a composition visual was updated; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/composition/tilt_animation.rs#L69)

## Trait implementations

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

## Availability

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