forked from svn2github/led-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animation.h
64 lines (49 loc) · 1.28 KB
/
Animation.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
/*
* Animation.h
*
* Copyright (c) 2011
* Remco Magielse & Serge Offermans
* Intelligent Lighting Institute (ILI), TU/e.
*
* All rights reserved. LAST UPDATE: 13-08-2012
*/
#ifndef Animation_h
#define Animation_h
/* The following code makes the Library compatible with Arduino 1.0 */
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "cppfix.h"
#endif
#ifndef DEFAULT_DURATION
#define DEFAULT_DURATION 1000
#endif
static const uint8_t LINEAR = 0;
static const uint8_t QUADRATIC = 1;
static const uint8_t EXPONENTIAL = 2;
static const uint8_t CIRCULAR = 3;
static const uint8_t SINUS = 4;
class Animation
{
public:
Animation();
~Animation();
uint8_t getValue();
uint8_t getEndValue();
void stopAnimation();
void startAnimation(int16_t startValue, int16_t endValue, uint32_t duration, bool throughZero = false);
void setAnimationType( uint8_t animType = LINEAR, bool easeIn = true, bool easeOut = true );
bool isAnimating();
protected:
uint32_t _startTime;
uint32_t _endTime;
uint8_t _startValue;
uint8_t _endValue;
uint8_t _isAnimating;
uint8_t _animType;
bool _easeIn;
bool _easeOut;
bool _shortcutThroughZero;
};
#endif