The gorious Lord Keith the Rat King can now have easing and motion functions that are defined in json and hot-reloaded.

This commit is contained in:
Zed A. Shaw 2026-02-04 00:59:26 -05:00
parent 383f839fdf
commit 07b2102f59
6 changed files with 69 additions and 18 deletions

View file

@ -60,11 +60,14 @@ namespace animate2 {
// handled by onLoop
bool toggled{false};
bool looped{false};
std::string easing{"in_out_back"};
std::string motion{"move_rush"};
// change to using a callback function for these
ease2::EaseFunc easing_func{ease2::get_easing(easing)};
ease2::MotionFunc motion_func{ease2::get_motion(motion)};
std::shared_ptr<sf::Shader> shader{nullptr};
// change to using a callback function for these
ease2::EaseFunc easing = ease2::in_out_back;
ease2::MoveFunc motion = ease2::move_rush;
void lerp(Sequence& seq, sf::Vector2f& pos_out, sf::Vector2f& scale_out);
};
@ -108,6 +111,7 @@ namespace animate2 {
ENROLL_COMPONENT(Sheet, frames, frame_width, frame_height);
ENROLL_COMPONENT(Sequence, frames, durations);
ENROLL_COMPONENT(Transform, min_x, min_y, max_x, max_y, simple, flipped, ease_rate, scaled, toggled, looped);
ENROLL_COMPONENT(Transform, min_x, min_y, max_x, max_y, simple,
flipped, ease_rate, scaled, toggled, looped, easing, motion);
ENROLL_COMPONENT(Animate2, sheet, sequence, transform);
}