FastLED
3.9.15
Loading...
Searching...
No Matches
transition.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
fl/namespace.h
"
4
#include "
fl/stdint.h
"
5
#include "
fl/int.h
"
6
7
namespace
fl
{
8
9
// Logic to control the progression of a transition over time.
10
class
Transition
{
11
public
:
12
Transition
() :
mStart
(0),
mDuration
(0),
mNotStarted
(true) {}
13
~Transition
() {}
14
15
uint8_t
getProgress
(fl::u32 now) {
16
if
(
mNotStarted
) {
17
return
0;
18
}
19
if
(now <
mStart
) {
20
return
0;
21
}
else
if
(now >=
mStart
+
mDuration
) {
22
return
255;
23
}
else
{
24
return
((now -
mStart
) * 255) /
mDuration
;
25
}
26
}
27
28
void
start
(fl::u32 now, fl::u32 duration) {
29
mNotStarted
=
false
;
30
mStart
= now;
31
mDuration
= duration;
32
}
33
34
void
end
() {
mNotStarted
=
true
; }
35
36
bool
isTransitioning
(fl::u32 now) {
37
if
(
mNotStarted
) {
38
return
false
;
39
}
40
return
now >=
mStart
&& now <
mStart
+
mDuration
;
41
}
42
43
private
:
44
fl::u32
mStart
;
45
fl::u32
mDuration
;
46
bool
mNotStarted
;
47
};
48
49
}
// namespace fl
fl::Transition::mNotStarted
bool mNotStarted
Definition
transition.h:46
fl::Transition::getProgress
uint8_t getProgress(fl::u32 now)
Definition
transition.h:15
fl::Transition::end
void end()
Definition
transition.h:34
fl::Transition::start
void start(fl::u32 now, fl::u32 duration)
Definition
transition.h:28
fl::Transition::isTransitioning
bool isTransitioning(fl::u32 now)
Definition
transition.h:36
fl::Transition::mStart
fl::u32 mStart
Definition
transition.h:44
fl::Transition::mDuration
fl::u32 mDuration
Definition
transition.h:45
fl::Transition::Transition
Transition()
Definition
transition.h:12
fl::Transition::~Transition
~Transition()
Definition
transition.h:13
int.h
namespace.h
Implements the FastLED namespace macros.
fl
IMPORTANT!
Definition
crgb.h:20
stdint.h
fx
detail
transition.h
Generated on Fri Aug 22 2025 20:59:33 for FastLED by
1.13.2