37 lines
793 B
C++
37 lines
793 B
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "event/Event.hpp"
|
|
#include "Easing.hpp"
|
|
#include "util/mathutils.hpp"
|
|
|
|
namespace Dawn {
|
|
struct Animation {
|
|
public:
|
|
bool_t loop = false;
|
|
bool_t finished = false;
|
|
float_t time = 0;
|
|
float_t duration = 0;
|
|
Event<> eventAnimationEnd;
|
|
|
|
virtual void tick(float_t delta) = 0;
|
|
|
|
/**
|
|
* Restart a running animation.
|
|
*/
|
|
virtual void restart() {
|
|
this->time = 0;
|
|
this->finished = false;
|
|
}
|
|
|
|
/**
|
|
* Clears an animaton of all its animation items and keyframes.
|
|
*/
|
|
virtual void clear() {
|
|
this->duration = 0;
|
|
}
|
|
};
|
|
} |