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

@ -41,7 +41,7 @@ namespace components {
}
void Animation::lerp(sf::Vector2f& scale_out, sf::Vector2f& pos_out) {
float tick = twitching();
float tick = std::abs(twitching());
if(stationary) {
switch(motion) {
@ -55,6 +55,7 @@ namespace components {
scale_out.x = std::lerp(min_x, max_x, tick);
scale_out.y = std::lerp(min_y, max_y, tick);
pos_out.y = pos_out.y - (pos_out.y * scale_out.y - pos_out.y);
fmt::println("RUSH pos={},{}; scale={},{}; tic={}", pos_out.x, pos_out.y, scale_out.x, scale_out.y, tick);
} break;
case ease::SQUEEZE: {
scale_out.x *= std::lerp(min_x, max_x, tick);
@ -73,6 +74,8 @@ namespace components {
pos_out.x = std::lerp(min_x, max_x, tick);
pos_out.y = std::lerp(min_y, max_y, tick);
} break;
case ease::NO_MOTION:
break;
default:
dbc::sentinel("Unknown animation.motion setting.");
}