-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimations.h
132 lines (117 loc) · 2.31 KB
/
animations.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "accelTools.h"
#include "ledTools.h"
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#ifndef ANIMATIONS_H
#define ANIMATIONS_H
class Animation
{
public:
bool finished = true;
virtual void step(){
//nop
}
virtual void reset(){
//nop
}
};
class ScanAnimation: public Animation
{
int currentLED = 0;
float x = 0;
bool started = false;
int brightness = 0;
int hue;
uint32_t c = Adafruit_NeoPixel::Color(0,0,255);
public:
double dx = 0.1;
ScanAnimation(int);
void step();
void reset();
};
class FlashHeadAnimation: public Animation
{
bool started = false;
bool up = true;
float up_speed = 0.1;
float down_speed = 0.3;
float saturation = 0.0;
float value = 0.0;
double x = 0;
double ticks = 0;
double base = 1.5;
int steps = 0;
public:
float hue = 0.0;
double dx = 1;
FlashHeadAnimation(float hue);
FlashHeadAnimation(float hue, float up_soeed, float down_speed);
void step();
void reset();
};
class ShootAnimation: public Animation
{
float current_position;
bool staff_done = false;
FlashHeadAnimation * flashHeadAnimation;
public:
float speed;
float hue;
ShootAnimation(float hue);
ShootAnimation(float hue, float speed);
void step();
void reset();
};
class ShootFromGripAnimation: public Animation
{
float current_position_up;
float current_position_down;
bool staff_up_done = false;
bool staff_down_done = false;
FlashHeadAnimation * flashHeadAnimation;
public:
float speed;
float hue;
ShootFromGripAnimation(float hue);
ShootFromGripAnimation(float hue, float speed);
void step();
void reset();
};
class BreatheAnimation: public Animation
{
float current_value=0.0;
public:
float speed = 0.0005;
float hue;
float max_value = 0.05;
float min_value = 0.001;
BreatheAnimation(float hue);
void step();
void reset();
};
class StarAnimation: public Animation
{
int * stars;
float * star_value;
float * star_speed;
float * star_hue;
public:
float speed = 0.0005;
float hue;
float max_value = 0.05;
float min_value = 0.001;
int num_stars;
StarAnimation(float hue, int num_stars);
void step();
void reset();
};
class FlashLightAnimation: public Animation
{
public:
float hue;
float value;
FlashLightAnimation(float value);
void step();
void reset();
};
#endif