# OrbitAnimation

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

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

```rust
struct OrbitAnimation
```

Maintains and applies a composition orientation for an orbit-style pointer interaction.

Deviation (DEVIATIONS.md, Behaviors): the orientation (a property with a private setter in
the reference) is kept in a cell, so that `rotate` and `reset` take `&self` as the methods of
the reference's class do.

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

## Members

- [`new`](#function-new)
- [`orientation`](#function-orientation)
- [`calculate_orientation`](#function-calculate_orientation)
- [`rotate`](#function-rotate)
- [`update_center_point`](#function-update_center_point)
- [`reset`](#function-reset)

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

### new

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

Creates an orbit animation at the identity orientation.

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

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

### orientation

```rust
fn orientation(self: &Self) -> Quaternion
```

Gets the current orientation.

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

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

### calculate_orientation

```rust
fn calculate_orientation(orientation: Quaternion, pointer_delta: Vector, sensitivity: f64) -> Quaternion
```

Calculates the next normalized orientation from the current `orientation` and the pointer
movement since the previous update; `sensitivity` is the rotation sensitivity.

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

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

### rotate

```rust
fn rotate(self: &Self, target: Option<&Control>, pointer_delta: Vector, sensitivity: f64) -> bool
```

Updates the orientation and applies it to a control's composition visual. 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/orbit_animation.rs#L49)

<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/orbit_animation.rs#L64)

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

### reset

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

Resets the maintained orientation to the identity quaternion.

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

## 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`
- `Debug`
- `Default`

## Availability

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