Skip to content

Easing Functions

Header: winui/ui/Animation.hpp.

struct BackEase

Pulls back by amplitude before moving (t³ − t·a·sin(πt)).

Example:

auto element = std::make_unique<ui::RectangleControl>();
element->start_animation(ui::AnimatedProperty::TranslationY,
                         ui::DoubleAnimation{.to       = 0.0f,
                                             .duration = 400ms,
                                             .easing   = ui::BackEase{.amplitude = 0.5f}});

Field Type Default
amplitude float 1.0f How far it pulls back; 0 is plain t cubed.
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct BounceEase

bounces bounces, each bounciness times smaller than the last (clamped above 1).

Field Type Default
bounces int 3 Number of bounces; negative is taken as 0.
bounciness float 2.0f Ratio between successive bounce heights.
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct CircleEase

A quarter circle.

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct CubicEase

t³.

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct ElasticEase

oscillations swings, damped exponentially by springiness.

Field Type Default
oscillations int 3 Number of swings; negative is taken as 0.
springiness float 3.0f Exponential damping of the swings.
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct ExponentialEase

(e^(k·t) − 1) / (e^k − 1).

Field Type Default
exponent float 2.0f k in the formula; 0 is linear.
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct PowerEase

t^power (a negative power is taken as 0).

Field Type Default
power float 2.0f The exponent.
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct QuadraticEase

t².

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct QuarticEase

t⁴.

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct QuinticEase

t⁵.

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

struct SineEase

A quarter sine.

Field Type Default
mode EasingMode EasingMode::EaseOut Which end the curve applies to.

Tests

  • tests/test_animation.cpp