diff --git a/config.h b/config.h index 796ef6f..79901af 100644 --- a/config.h +++ b/config.h @@ -11,7 +11,7 @@ #define MAX_MULTI_COLOR_TEXT_NODES_COUNT $ #define MAX_TEXT_NODES_COUNT 4 #define MAX_IMAGES_SAVED 2 -#define MAX_ANIMATION_FRAME_COUNT 32 +#define MAX_ANIMATION_FRAME_COUNT 12 #define MAX_ANIMATIONS_COUNT 2 #define SMALL_TEXT_HEIGHT 7 diff --git a/ledy.ino b/ledy.ino index 23c8cd4..b897162 100644 --- a/ledy.ino +++ b/ledy.ino @@ -24,6 +24,8 @@ bool main_animation_started = false; unsigned char bottom_text_state = 0; // 0 = "Technik informatyk", 1 = "technik programista" unsigned char scroll_node_global_id = 0; // tracks current bottom-row node bool scroll_node_active = false; +unsigned long main_animation_start_time = 0; +bool example_animation_triggered = false; Image saved_images[MAX_IMAGES_SAVED] = { {},{} @@ -397,6 +399,30 @@ void stopAnimation(unsigned char index) animations[index].is_playing = false; } +void displayExampleSlideAnimation() +{ + if (!animations[0].is_playing) return; + + short offset_x = (DISPLAY_MAX_X + 1) - (short)animations[0].current_frame * 2; + + for (unsigned char y = 0; y < PANEL_PIXEL_COUNT; y++) + { + for (unsigned char bx = 0; bx < PANEL_PIXEL_COUNT; bx++) + { + short px = offset_x + bx; + if (px < 0 || px > DISPLAY_MAX_X) continue; + + unsigned char r, g, b; + if (y < 4) { r = 50; g = 0; b = 0; } + else if (y < 8) { r = 0; g = 50; b = 0; } + else if (y < 12) { r = 0; g = 0; b = 50; } + else { r = 50; g = 25; b = 0; } + + setPixel(px, y, pixels.Color(r, g, b)); + } + } +} + void handleDisappearTimers() { for (unsigned char i = 0; i < MAX_TEXT_NODES_COUNT; i++) @@ -471,6 +497,7 @@ void loop() if (!isNodeExistingByGlobal(0) && !isNodeExistingByGlobal(1)) { main_animation_started = true; + main_animation_start_time = millis(); // Top row: "Witamy w PTI" — slow scroll, repeating, white + blue PTI addNewMultiColor("Witamy w PTI", @@ -506,11 +533,20 @@ void loop() } } + if (main_animation_started && !example_animation_triggered && millis() - main_animation_start_time > 15000) + { + example_animation_triggered = true; + animations[0].frame_count = 32; + playAnimation(0, 3, false); + } + pixels.clear(); handle_server(); handleDisappearTimers(); handleMultiColorDisappearTimers(); scrollAllScrollableTexts(true); scrollAllMultiColorTexts(true); + tickAnimations(); + displayExampleSlideAnimation(); pixels.show(); } \ No newline at end of file