All of the original features now work: simple, flipped, scaled, toggled, looped and stationary is replaced by ease2::scale_only.

This commit is contained in:
Zed A. Shaw 2026-01-31 11:40:45 -05:00
parent 34e4a34f65
commit ca335d21e5
4 changed files with 25 additions and 11 deletions

View file

@ -35,6 +35,8 @@ namespace animate2 {
// need one for each kind of thing to animate
// NOTE: possibly find a way to only run apply on frame change?
void Animate2::apply(sf::Sprite& sprite) {
dbc::check(!$transform.simple, "can't call ::apply() on a simple animation, only ::motion()");
dbc::check($sequence.current < $frame_rects.size(), "current frame past $frame_rects");
// NOTE: pos is not updated yet
auto& rect = $frame_rects.at($sequence.current);
@ -76,8 +78,15 @@ namespace animate2 {
void Animate2::motion(sf::Sprite& sprite, sf::Vector2f pos, sf::Vector2f scale) {
$transform.lerp($sequence, pos, scale);
if($transform.flipped) {
scale.x *= -1;
}
sprite.setPosition(pos);
sprite.setScale(scale);
if($transform.scaled) {
sprite.setScale(scale);
}
}
std::pair<int, double> Animate2::commit() {