MCPcopy Create free account
hub / github.com/FastLED/FastLED / loop

Function loop

examples/EaseInOut/EaseInOut.h:95–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void loop() {
96 // Clear the matrix using fl::clear for LedsXY
97 fl::clear(leds);
98
99 // Get the current slider value (0.0 to 1.0)
100 float sliderValue = xPosition.value();
101
102 // Map slider value to X coordinate (0 to width-1)
103 uint8_t x = map(sliderValue * 1000, 0, 1000, 0, MATRIX_WIDTH - 1);
104
105 // Get the selected ease type using the dropdown index
106 fl::EaseType selectedEaseType = getEaseType(easeTypeDropdown.as_int());
107
108 uint8_t y;
109 if (use16Bit.value()) {
110 // Use 16-bit precision
111 uint16_t easeInput = map(sliderValue * 1000, 0, 1000, 0, 65535);
112 uint16_t easeOutput = ease16(selectedEaseType, easeInput);
113 y = map(easeOutput, 0, 65535, 0, MATRIX_HEIGHT - 1);
114 } else {
115 // Use 8-bit precision
116 uint8_t easeInput = map(sliderValue * 1000, 0, 1000, 0, 255);
117 uint8_t easeOutput = ease8(selectedEaseType, easeInput);
118 y = map(easeOutput, 0, 255, 0, MATRIX_HEIGHT - 1);
119 }
120
121 // Draw white dot at the calculated position using splat rendering
122 if (x < MATRIX_WIDTH && y < MATRIX_HEIGHT) {
123 leds(x, y) = fl::CRGB::White;
124 }
125
126 FastLED.show();
127}

Callers

nothing calls this directly

Calls 8

mapFunction · 0.85
ease16Function · 0.85
ease8Function · 0.85
getEaseTypeFunction · 0.70
clearFunction · 0.50
valueMethod · 0.45
as_intMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected