|
Tweeny 4.1.0
A Tweening library for modern C++
|
◆ stepped
Stepped easing that holds the start value until the keyframe completes. The stepped easing function returns the starting value throughout the entire duration of the keyframe segment, only jumping to the target value when moving to the next keyframe. This creates instant transitions between keyframes without any interpolation within each segment. Characteristics:
This easing is ideal for:
Stepped is fundamentally different from other easings because it eliminates interpolation entirely within each keyframe segment, creating hard cuts between animation states. // Hold value at each keyframe, jump instantly between them
auto value = tweeny::from(0)
.to(20).via(easing::stepped).during(100U)
.to(30).via(easing::stepped).during(100U)
.build();
// During frames 0-99: returns 0
// During frames 100-199: returns 10
// During frames 200-299: returns 20
// At frame 300: returns 30
// Useful for sprite animation indices
auto spriteIndex = tweeny::from(0)
.to(2).via(easing::stepped).during(10U)
.to(3).via(easing::stepped).during(10U)
.build();
// Holds each sprite index for 10 frames, then instantly switches
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::steppedEasing stepped Stepped easing that holds the start value until the keyframe completes. Definition easing.h:1465 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
|