Files
2025-02-24 23:03:13 +01:00

32 lines
633 B
C++

//
// Created by Daniil Vinogradov on 12/01/2024.
//
#pragma once
#include <CADisplayLink.h>
#include <Timer.h>
namespace NXKit {
class TimerAnimation: enable_shared_from_this_pointer_holder {
public:
TimerAnimation(double duration, std::function<void(float, double)> animations, std::function<void(bool)> completion = [](bool _){});
~TimerAnimation();
void invalidate();
private:
CADisplayLink displayLink;
bool _running = true;
Timer firstFrameTimestamp;
double duration;
std::function<void(float, double)> animations;
std::function<void(bool)> completion;
void handleFrame();
};
}