1#include "Animation.hpp"
2#include "./DrawUtils.hpp"
4Animation::Animation(
int startTime,
int duration, std::function<
void(
float)> onStep, std::function<
void()> onFinish) {
5 this->startTime = startTime;
6 this->duration = duration;
8 this->onFinish = onFinish;
11bool Animation::isFinished() {
12 return CST_GetTicks() > startTime + duration;
15bool Animation::step() {
22 float progress = (float)(CST_GetTicks() - startTime) / (
float)duration;