Working on how to do an idle 'breathing' animation for sprites.

This commit is contained in:
Zed A. Shaw 2025-10-28 01:03:59 -04:00
parent 2ecd8528ea
commit 26d313269c
3 changed files with 28 additions and 9 deletions

View file

@ -17,7 +17,7 @@ namespace components {
case ease::NONE:
return 0.0;
case ease::SINE:
return tick;
return std::abs(std::sin(subframe * ease_rate));
case ease::OUT_CIRC:
return ease::out_circ(tick);
case ease::OUT_BOUNCE:
@ -41,6 +41,7 @@ namespace components {
if(playing && current < frames) {
float tick = twitching();
fmt::print("tick: {}\r", tick);
if(stationary) {
switch(motion) {
@ -178,9 +179,9 @@ namespace animation {
return MGR.animations.contains(name);
}
Animation load(const std::string& name) {
Animation load(const std::string& name, const std::string& state) {
dbc::check(initialized, "You forgot to initialize animation.");
return MGR.animations.at(name);
return MGR.animations.at(name + state);
}
void configure(DinkyECS::World& world, DinkyECS::Entity entity) {