-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimationController.h
53 lines (37 loc) · 1.22 KB
/
AnimationController.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
#ifndef AnimationController_h
#define AnimationController_h
#include "Leds.h"
#include "animations/Animation.h"
#include "Arduino.h"
#include <FastLED.h>
#ifndef ANIMATION_SLOTS
#define ANIMATION_SLOTS 8
#endif
#define DEFAULT_FRAME_INTERVAL 100
class AnimationController
{
//need to keep track of time at a class level
Animation* animations[ANIMATION_SLOTS];
unsigned long last_frame_start_times[ANIMATION_SLOTS];
bool active[ANIMATION_SLOTS] = {false};
public:
uint16_t frame_interval = DEFAULT_FRAME_INTERVAL; //ms
// Create an instance of the AnimationController library
AnimationController();
//FPS = 1000/frame_interval
void set_fps(uint8_t fps);
// run a specific pattern right now
//not sure yet how this plays with duration
//void run(Pattern pattern, list of args);
//set animation in slot
void set(Animation * animation, uint8_t slot_index);
//clear all animation slots
void clear();
//Select pattern by index. Wraps around if pattern index > number of patterns
void fire_animation(uint8_t slot_index);
//Analagous to FastLED show
void show();
protected:
unsigned long previous_millis;
};
#endif