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

28
ease2.hpp Normal file
View file

@ -0,0 +1,28 @@
#include <functional>
#include "animate2.hpp"
namespace animate2 {
struct Transform;
}
namespace ease2 {
using EaseFunc = std::function<double(double)>;
using MoveFunc = std::function<void(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick)>;
double sine(double x);
double out_circ(double x);
double out_bounce(double x);
double in_out_back(double x);
double random(double tick);
double normal_dist(double tick);
void move_bounce(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void move_rush(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void scale_squeeze(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void scale_squash(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void scale_strech(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void scale_grow(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void move_slide(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void move_none(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
void scale_only(animate2::Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick);
}