From bff1e53c4289a204f0da256d4a73fa48d7267f86 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:12:17 +0200 Subject: [PATCH] Berry animation fix foc (#23833) --- .../berry_animation/docs/DSL_REFERENCE.md | 46 +++++++++---------- .../berry_animation/docs/QUICK_START.md | 46 +++++++++---------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/libesp32/berry_animation/docs/DSL_REFERENCE.md b/lib/libesp32/berry_animation/docs/DSL_REFERENCE.md index a09687895..1edc6c8b1 100644 --- a/lib/libesp32/berry_animation/docs/DSL_REFERENCE.md +++ b/lib/libesp32/berry_animation/docs/DSL_REFERENCE.md @@ -13,7 +13,7 @@ Comments use the `#` character and extend to the end of the line: ```berry # This is a full-line comment # strip length 30 # This is an inline comment (TEMPORARILY DISABLED) -color red = #FF0000 # This is an inline comment +color bordeaux = 0x6F2C4F # This is an inline comment ``` Comments are preserved in the generated code and can appear anywhere in the DSL. @@ -27,18 +27,18 @@ A DSL program consists of statements that can appear in any order: # strip length 60 # TEMPORARILY DISABLED # Color definitions -color red = #FF0000 -color blue = #0000FF +color bordeaux = 0x6F2C4F +color majorelle = 0x6050DC # Animation definitions -animation pulse_red = pulsating_animation(color=red, period=2s) +animation pulse_bordeaux = pulsating_animation(color=bordeaux, period=2s) # Property assignments pulse_red.priority = 10 # Sequences sequence demo { - play pulse_red for 5s + play pulse_bordeaux for 5s wait 1s } @@ -213,27 +213,27 @@ The `color` keyword defines static colors or color providers: ```berry # Static colors -color red = 0xFF0000 # Static hex color -color blue = 0x0000FF # Static hex color +color bordeaux = 0x6F2C4F # Static hex color +color majorelle = 0x6050DC # Static hex color color semi_red = 0x80FF0000 # Static color with alpha channel color my_white = white # Reference to predefined color # Color providers for dynamic colors color rainbow_cycle = color_cycle( - palette=[red, green, blue], + palette=[red, green, blue] cycle_period=5s ) color breathing_red = breathe_color( - base_color=red, - min_brightness=20, - max_brightness=255, - duration=3s, + base_color=red + min_brightness=5% + max_brightness=100% + duration=3s curve_factor=2 ) color pulsing_blue = pulsating_color( - base_color=blue, - min_brightness=50, - max_brightness=200, + base_color=blue + min_brightness=20% + max_brightness=80% duration=1s ) ``` @@ -249,8 +249,8 @@ Standard palettes use value positions from 0-255: ```berry # Traditional syntax with commas palette fire_colors = [ - (0, 0x000000), # Position 0: Black - (128, 0xFF0000), # Position 128: Red + (0, 0x000000) # Position 0: Black + (128, 0xFF0000) # Position 128: Red (255, 0xFFFF00) # Position 255: Yellow ] @@ -276,8 +276,8 @@ Palettes can also use tick counts for timing-based transitions: ```berry palette timed_colors = [ - (10, 0xFF0000), # Red for 10 ticks - (20, 0x00FF00), # Green for 20 ticks + (10, 0xFF0000) # Red for 10 ticks + (20, 0x00FF00) # Green for 20 ticks (15, 0x0000FF) # Blue for 15 ticks ] ``` @@ -298,14 +298,14 @@ The `animation` keyword defines instances of animation classes (subclasses of An animation red_solid = solid(color=red) animation pulse_effect = pulsating_animation( - color=blue, + color=blue period=2s ) animation comet_trail = comet_animation( - color=white, - tail_length=10, - speed=1500, + color=white + tail_length=10 + speed=1500 direction=1 ) ``` diff --git a/lib/libesp32/berry_animation/docs/QUICK_START.md b/lib/libesp32/berry_animation/docs/QUICK_START.md index fef28ff44..d5124240e 100644 --- a/lib/libesp32/berry_animation/docs/QUICK_START.md +++ b/lib/libesp32/berry_animation/docs/QUICK_START.md @@ -13,13 +13,13 @@ Create a simple pulsing red light: ```berry # Define colors -color red = #FF0000 +color bordeaux = 0x6F2C4F # Create pulsing animation -animation pulse_red = pulsating_animation(color=red, period=3s) +animation pulse_bordeaux = pulsating_animation(color=bordeaux, period=3s) # Run it -run pulse_red +run pulse_bordeaux ``` ## Step 2: Color Cycling @@ -29,8 +29,8 @@ Create smooth color transitions: ```berry # Use predefined rainbow palette animation rainbow_cycle = rich_palette( - palette=PALETTE_RAINBOW, - cycle_period=5s, + palette=PALETTE_RAINBOW + cycle_period=5s transition_type=1 ) @@ -44,17 +44,17 @@ Create your own color palettes: ```berry # Define a sunset palette palette sunset = [ - (0, #191970), # Midnight blue - (64, purple), # Purple - (128, #FF69B4), # Hot pink - (192, orange), # Orange + (0, 0x191970) # Midnight blue + (64, purple) # Purple + (128, 0xFF69B4) # Hot pink + (192, orange) # Orange (255, yellow) # Yellow ] # Create palette animation animation sunset_glow = rich_palette( - palette=sunset, - cycle_period=8s, + palette=sunset + cycle_period=8s transition_type=1 ) @@ -93,23 +93,23 @@ Add movement and variation to your animations: ```berry # Breathing effect with smooth oscillation animation breathing = pulsating_animation( - color=blue, - min_brightness=50, - max_brightness=255, + color=blue + min_brightness=20% + max_brightness=100% period=4s ) # Moving comet effect animation comet = comet_animation( - color=white, - tail_length=8, + color=white + tail_length=8 speed=2000 ) # Sparkle effect animation sparkles = sparkle_animation( - color=white, - density=80, + color=white + density=80 fade_speed=60 ) @@ -121,8 +121,8 @@ run breathing ### Fire Effect ```berry animation fire = rich_palette( - palette=PALETTE_FIRE, - cycle_period=2s, + palette=PALETTE_FIRE + cycle_period=2s transition_type=1 ) @@ -132,8 +132,8 @@ run fire ### Ocean Waves ```berry animation ocean = rich_palette( - palette=PALETTE_OCEAN, - cycle_period=6s, + palette=PALETTE_OCEAN + cycle_period=6s transition_type=1 ) @@ -179,7 +179,7 @@ animation.register_user_function("sparkle", my_sparkle) ```berry # Use in DSL - engine is automatically passed -animation gold_sparkles = sparkle(#FFD700, 8, 500ms) +animation gold_sparkles = sparkle(0xFFD700, 8, 500ms) run gold_sparkles ```