| 1002 | } |
| 1003 | |
| 1004 | void MovingLine(FastLED_NeoMatrix *matrix, int16_t x, int16_t y, EffectSettings *settings) |
| 1005 | { |
| 1006 | static int16_t linePosition = 0; // Start position of the line |
| 1007 | static int8_t direction = 1; // Direction of the line movement |
| 1008 | |
| 1009 | // Control the speed of the line |
| 1010 | static uint32_t lastUpdate = 0; |
| 1011 | if (millis() - lastUpdate > 100 - settings->speed * 10) |
| 1012 | { |
| 1013 | lastUpdate = millis(); |
| 1014 | |
| 1015 | // Move the line |
| 1016 | linePosition += direction; |
| 1017 | if (linePosition <= 0 || linePosition + 1 >= 8) |
| 1018 | { |
| 1019 | direction = -direction; |
| 1020 | } |
| 1021 | colorIndex += 1; |
| 1022 | } |
| 1023 | |
| 1024 | // Draw the line |
| 1025 | for (int16_t i = 0; i < 1; i++) |
| 1026 | { |
| 1027 | for (uint16_t j = 0; j < 32; j++) |
| 1028 | { |
| 1029 | matrix->drawPixel(x + j, y + linePosition + i, ColorFromPalette(settings->palette, colorIndex, 255, settings->blend ? LINEARBLEND : NOBLEND)); |
| 1030 | } |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | void Fade(FastLED_NeoMatrix *matrix, int16_t x, int16_t y, EffectSettings *settings) |
| 1035 | { |