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

◆ cubicInOut

detail::cubicInOutEasing cubicInOut {}
inlineconstexpr

Cubic polynomial easing with balanced acceleration and deceleration.

The cubicInOut easing function combines cubic acceleration and deceleration for smooth, professional motion. This is one of the most popular general-purpose easings.

Motion profile:

  • First half: Cubic acceleration (t³)
  • Midpoint: Maximum velocity
  • Second half: Cubic deceleration
  • Creates smooth, balanced S-curve

This easing is appropriate for:

  • All-purpose animations: When in doubt, use this
  • Web standards: CSS ease-in-out equivalent
  • Design system defaults: Common in component libraries
  • Cross-platform consistency: Works well everywhere
  • Medium animations: 200-500ms sweet spot

CubicInOut is frequently the default easing in design systems and animation libraries because it provides clear, professional motion that works for most scenarios.

Mathematically: Combines cubicIn for t < 0.5 and cubicOut for t >= 0.5

// Page transition
auto x = tweeny::from(0.0f)
.to(1920.0f)
.during(40U)
.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::cubicInOutEasing cubicInOut
Cubic polynomial easing with balanced acceleration and deceleration.
Definition easing.h:546
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
cubicIn For only acceleration
cubicOut For only deceleration
quadraticInOut For gentler motion
quarticInOut For more dramatic motion
Visualize at https://easings.net/#easeInOutCubic