Ease2 is the new way to do easing functions.

This commit is contained in:
Zed A. Shaw 2026-01-22 22:32:13 -05:00
parent 31b815d43e
commit c0f69ed026
9 changed files with 151 additions and 75 deletions

View file

@ -25,7 +25,7 @@ Animate2 crafter() {
Sequence sequence{
.frames{0,1},
.durations{Random::milliseconds(33, 100), Random::milliseconds(33, 100)}
.durations{Random::milliseconds(1, 33), Random::milliseconds(1, 33)}
};
REQUIRE(sequence.frame_count == sequence.frames.size());
@ -36,16 +36,16 @@ Animate2 crafter() {
.min_y{0.6f},
.max_x{0.8f},
.max_y{0.8f},
.simple{true},
.simple{false},
.flipped{false},
.ease_rate{0.5f},
.speed{0.1f},
.scaled{false},
.speed{0.02f},
.scaled{true},
.stationary{true},
.toggled{false},
.looped{false},
.easing = ease::IN_OUT_BACK,
.motion = ease::RUSH,
.easing = ease2::in_out_back,
.motion = ease2::move_rush,
};
return {sheet, sequence, transform};
@ -168,6 +168,7 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
while(anim.playing) {
anim.update();
anim.motion(pos, scale);
std::this_thread::sleep_for(10ms);
fmt::println("POSITION: {},{}; SCALE: {},{}; current: {}; subframe: {}",
pos.x, pos.y, scale.x, scale.y, anim.$sequence.current, anim.$sequence.subframe);
}