FastLED 3.9.15
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 97 of file EaseInOut.h.

97 {
98 // Clear the matrix using fl::clear for LedsXY
100
101 // Get the current slider value (0.0 to 1.0)
102 float sliderValue = xPosition.value();
103
104 // Map slider value to X coordinate (0 to width-1)
105 uint8_t x = map(sliderValue * 1000, 0, 1000, 0, MATRIX_WIDTH - 1);
106
107 // Get the selected ease type using the dropdown index
108 EaseType selectedEaseType = getEaseType(easeTypeDropdown.as_int());
109
110 uint8_t y;
111 if (use16Bit.value()) {
112 // Use 16-bit precision
113 uint16_t easeInput = map(sliderValue * 1000, 0, 1000, 0, 65535);
114 uint16_t easeOutput = ease16(selectedEaseType, easeInput);
115 y = map(easeOutput, 0, 65535, 0, MATRIX_HEIGHT - 1);
116 } else {
117 // Use 8-bit precision
118 uint8_t easeInput = map(sliderValue * 1000, 0, 1000, 0, 255);
119 uint8_t easeOutput = ease8(selectedEaseType, easeInput);
120 y = map(easeOutput, 0, 255, 0, MATRIX_HEIGHT - 1);
121 }
122
123 // Draw white dot at the calculated position using splat rendering
124 if (x < MATRIX_WIDTH && y < MATRIX_HEIGHT) {
125 leds(x, y) = CRGB::White;
126 }
127
128 FastLED.show();
129}
CRGB leds[NUM_LEDS]
int y
Definition simple.h:93
int x
Definition simple.h:92
#define MATRIX_HEIGHT
Definition EaseInOut.h:19
EaseType getEaseType(int value)
Definition EaseInOut.h:58
LedsXY< MATRIX_WIDTH, MATRIX_HEIGHT > leds
Definition EaseInOut.h:30
UIDropdown easeTypeDropdown("Ease Type", easeOptions)
UICheckbox use16Bit("16-bit", true)
UISlider xPosition("xPosition", 0.0f, 0.0f, 1.0f, 0.01f)
#define MATRIX_WIDTH
Definition EaseInOut.h:18
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
void clear(CRGB(&arr)[N])
Definition clear.h:13
u16 ease16(EaseType type, u16 i)
Definition ease.h:126
u8 ease8(EaseType type, u8 i)
Definition ease.h:202
EaseType
Definition ease.h:21
@ White
<div style='background:#FFFFFF;width:4em;height:4em;'></div>
Definition crgb.h:703

References fl::clear(), fl::ease16(), fl::ease8(), easeTypeDropdown(), FastLED, getEaseType(), leds, MATRIX_HEIGHT, MATRIX_WIDTH, use16Bit(), CRGB::White, x, xPosition(), and y.

+ Here is the call graph for this function: