Tweeny 4.1.0
A Tweening library for modern C++
Loading...
Searching...
No Matches

◆ elasticOut

detail::elasticOutEasing elasticOut {}
inlineconstexpr

Elastic easing with spring-like oscillation at the end.

The elasticOut easing function creates a natural spring or rubber band effect that overshoots and oscillates around the target value before settling. This is one of the most visually distinctive and playful easings, mimicking real-world elastic physics.

The oscillation characteristics:

  • Overshoots the target value multiple times
  • Amplitude decreases with each oscillation (damped motion)
  • Settles naturally at the final value
  • Creates a bouncy, energetic feel without the hard impacts of bounce easing

This easing excels at:

  • Playful UI animations: Buttons, toggles, modal appearances
  • Game elements: Power-up notifications, achievement popups, score displays
  • Cartoon-style motion: Exaggerated, entertaining character movements
  • Attention direction: Drawing eyes to important elements
  • Spring simulation: Rubber bands, diving boards, springy objects
  • Joyful interactions: Adding personality to standard UI patterns

ElasticOut is widely used in modern mobile UI design to add energy and delight to interactions. It's more pronounced than backOut but smoother than bounceOut.

The spring feel makes animations memorable and adds perceived responsiveness, making interfaces feel "alive" rather than mechanical.

Mathematically, this uses a decaying sine wave with exponentially decreasing amplitude.

Warning
Values will oscillate beyond the target in both directions before settling. For example, animating from 0 to 100 might temporarily reach 110, then 95, then 102, before settling at 100. Ensure clipping or overflow handling is appropriate.
// Springy button press feedback
auto scale = tweeny::from(1.0f)
.to(1.2f)
.during(40U)
.build();
// Scale will overshoot 1.2f (maybe 1.3f) then oscillate
// down and up before settling at exactly 1.2f
// Modal dialog with playful entrance
auto opacity = tweeny::from(0.0f)
.to(1.0f)
.during(50U)
.build();
tweeny_builder< true, FirstValue, RemainingValues... > to(const FirstValue &firstComponent, const RemainingValues &... remainingComponents) &
Adds a target keyframe to the tween.
Definition tweeny.h:109
tweeny_builder & via(EasingFunctionTypes... easing_functions)
Specifies per-component easing functions for the last keyframe segment.
Definition tweeny.h:198
constexpr detail::elasticOutEasing elasticOut
Elastic easing with spring-like oscillation at the end.
Definition easing.h:678
tweeny_builder< false, FirstValue, RemainingValues... > from(FirstValue firstComponent, RemainingValues... remainingComponents)
Creates a new tween builder starting from the specified value(s).
Definition tweeny.h:347
See also
elasticIn For spring anticipation at the start
elasticInOut For oscillation at both ends
backOut For a subtler single-overshoot alternative
bounceOut For a similar but impact-based bouncing effect
Visualize at https://easings.net/#easeOutElastic