# SpringScalarNaturalMotionAnimation

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/animations/struct-springscalarnaturalmotionanimation/

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

```rust
struct SpringScalarNaturalMotionAnimation
```

A spring animation of scalar values (WinUI `SpringScalarNaturalMotionAnimation`): each component moves on a damped harmonic oscillator of the given damping ratio and period.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

## Members

- [`new`](#function-new)
- [`damping_ratio`](#function-damping_ratio)
- [`set_damping_ratio`](#function-set_damping_ratio)
- [`period`](#function-period)
- [`set_period`](#function-set_period)

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

### new

```rust
fn new(compositor: &Rc<Compositor>) -> Rc<SpringScalarNaturalMotionAnimation>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

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

### damping_ratio

```rust
fn damping_ratio(self: &Self) -> f32
```

The damping ratio of the spring: 1 (the default) comes to rest
as fast as possible without overshooting, less overshoots and
oscillates, more comes to rest slower; 0 oscillates forever.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

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

### set_damping_ratio

```rust
fn set_damping_ratio(self: &Self, value: f32)
```

Sets the damping ratio. Panics when it is negative or not a
number.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

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

### period

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

The period of the oscillation of the spring without damping;
a shorter period is a stiffer spring.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

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

### set_period

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

Sets the period. Panics when it is zero.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/animations/natural_motion_animation.rs#L296)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `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`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- `ICompositionAnimationBase`
- `ICompositionAnimation`
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)

## Availability

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