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

◆ loop()

void loop ( )

Definition at line 95 of file EaseInOut.h.

95 {
96 // Clear the matrix using fl::clear for LedsXY
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) {
124 }
125
126 FastLED.show();
127}
#define MATRIX_HEIGHT
fl::CRGB leds[NUM_LEDS]
#define MATRIX_WIDTH
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::UIDropdown easeTypeDropdown("Ease Type", easeOptions)
fl::UICheckbox use16Bit("16-bit", true)
fl::EaseType getEaseType(int value)
Definition EaseInOut.h:56
fl::LedsXY< MATRIX_WIDTH, MATRIX_HEIGHT > leds
Definition EaseInOut.h:28
fl::UISlider xPosition("xPosition", 0.0f, 0.0f, 1.0f, 0.01f)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
u8 ease8(EaseType type, u8 i) FL_NOEXCEPT
Definition ease.h:208
void clear(CRGB(&arr)[N])
Definition clear.h:12
fl::u16 uint16_t
Definition s16x16x4.h:214
MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > > map
Definition map.h:283
u16 ease16(EaseType type, u16 i) FL_NOEXCEPT
Definition ease.h:132
EaseType
Definition ease.h:27
unsigned char uint8_t
Definition s16x16x4.h:209
@ White
<div style='background:#FFFFFF;width:4em;height:4em;'></div>
Definition crgb.h:646

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

+ Here is the call graph for this function: