From 35ab9c9480c517c8dfa4f46c89277778fe7715f7 Mon Sep 17 00:00:00 2001 From: "C. J. Howard" Date: Wed, 5 Aug 2020 21:43:51 -0700 Subject: [PATCH] Make animations call frame callback on end --- src/animation/animation.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/animation/animation.hpp b/src/animation/animation.hpp index 3f7f625..6bd1865 100644 --- a/src/animation/animation.hpp +++ b/src/animation/animation.hpp @@ -26,6 +26,7 @@ #include #include #include +#include /** * Abstract base class for animations. @@ -451,6 +452,19 @@ void animation::advance(double dt) { stopped = true; + // Call frame callback for end frame + if (frame_callback != nullptr) + { + for (std::size_t i = 0; i < channels.size(); ++i) + { + auto frames = channels[i].find_keyframes(channels[i].get_duration()); + if (frames[0] != nullptr) + { + frame_callback(static_cast(i), std::get<1>(*frames[0])); + } + } + } + // Call end callback if (end_callback) {