-
Notifications
You must be signed in to change notification settings - Fork 4
/
Timeline.h
60 lines (43 loc) · 1.36 KB
/
Timeline.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef TWEEN_DUINO_TIMELINE_H
#define TWEEN_DUINO_TIMELINE_H
#ifndef TWEEN_TIMELINE_SIZE
#define TWEEN_TIMELINE_SIZE 20
#endif
#include <Tween.h>
namespace TweenDuino {
class Timeline {
public:
Timeline();
Timeline(const Timeline&) = delete;
Timeline& operator=(Timeline const&) = delete;
void wipe();
void begin(unsigned long startTime);
bool isActive();
void update(unsigned long time);
TweenDuino::Tween* addTo(float& target, float to, unsigned long duration);
TweenDuino::Tween* addTo(float& target, float to, unsigned long duration, TweenDuino::Tween::Ease e, TweenDuino::Tween::EaseType type);
bool add(TweenDuino::Tween &tween);
void restartFrom(unsigned long newStart);
int maxChildren();
unsigned long getDuration();
bool isComplete();
private:
class TimelineEntry {
public:
TimelineEntry();
~TimelineEntry();
// Is the timeline responsible for this tween, or did it come from external code?
bool tlManagedTween = false;
Tween *tween;
};
TweenDuino::Timeline::TimelineEntry tweens[TWEEN_TIMELINE_SIZE];
bool addEntry(TweenDuino::Tween &tween, bool managed = false);
unsigned long totalDuration;
unsigned long totalTime;
unsigned long startTime;
unsigned long lastUpdateTime;
bool completed;
bool initialized;
};
}
#endif