Animation.h 638 Bytes
Newer Older
's avatar
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef __ANIMATION_H
#define __ANIMATION_H

#include <functional>

namespace glare
{
	namespace core
	{
		class AnimationManager;

		struct Animation
		{
			friend class AnimationManager;
			double duration;
			double start_delay = 0;

			std::function<void(double, double)> on_update;
			std::function<void()> on_start;
			std::function<void()> on_finish;
			std::function<void()> on_cancel;

		private:
			//From 0..1
			double current_time = 0;
			double current_value = 0;
			bool has_started = false;
			bool mark_finished = false;
		};
	}
}

#include "AnimationManager.h"

#endif //__ANIMATION_H