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

◆ backIn

detail::backInEasing backIn {}
inlineconstexpr

Easing function that creates anticipation by pulling back before moving forward.

The backIn easing function begins by moving backwards slightly (overshooting in the negative direction), then reverses and accelerates toward the target value. This creates an anticipation effect similar to pulling back a slingshot or winding up before a throw.

The backward motion at the start makes this easing particularly effective for animations that benefit from telegraphing or anticipation, such as:

  • UI elements that "wind up" before sliding in
  • Character movements that show preparation before action
  • Camera movements that pull back before zooming forward

Mathematically, this easing uses the formula: c * t * t * ((s + 1) * t - s) + b where s controls the overshoot amount (typically 1.70158).

Note
The animation will briefly have values less than the start value before proceeding to the target. Ensure your animation system can handle values outside the expected range.
// Create a tween with back-in easing for anticipation effect
auto tween = tweeny::from(0.0f)
.to(100.0f)
.during(60U)
.build();
// The animation will dip below 0.0f briefly before accelerating to 100.0f
A tween represents an animation between keyframes.
Definition tween.h:68
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::backInEasing backIn
Easing function that creates anticipation by pulling back before moving forward.
Definition easing.h:91
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
backOut For overshoot at the end instead of the beginning
backInOut For anticipation at the start and overshoot at the end
Visualize at https://easings.net/#easeInBack