# Generated Berry code from Animation DSL # Source: palette_showcase.anim # # This file was automatically generated by compile_all_examples.sh # Do not edit manually - changes will be overwritten import animation # Palette Showcase - Demonstrates all palette features # This example shows the full range of palette capabilities #strip length 60 # Example 1: Fire palette with hex colors # Auto-generated strip initialization (using Tasmota configuration) var engine = animation.init_strip() var fire_gradient_ = bytes( "00000000" # Black (no fire) "20330000" # Very dark red "40660000" # Dark red "60CC0000" # Red "80FF3300" # Red-orange "A0FF6600" # Orange "C0FF9900" # Light orange "E0FFCC00" # Yellow-orange "FFFFFF00" # Bright yellow ) # Example 2: Ocean palette with named colors var ocean_depths_ = bytes( "00000000" # Deep ocean "40000080" # Deep blue "800000FF" # Ocean blue "C000FFFF" # Shallow water "FFFFFFFF" # Foam/waves ) # Example 3: Aurora palette (from the original example) var aurora_borealis_ = bytes( "00000022" # Dark night sky "40004400" # Dark green "8000AA44" # Aurora green "C044AA88" # Light green "FF88FFAA" # Bright aurora ) # Example 4: Sunset palette mixing hex and named colors var sunset_sky_ = bytes( "00191970" # Midnight blue "40800080" # Purple twilight "80FF69B4" # Hot pink "C0FFA500" # Sunset orange "FFFFFF00" # Sun ) # Create animations using each palette var fire_effect_ = animation.solid(engine) fire_effect_.color = (def (engine) var provider = animation.rich_palette(engine) provider.palette = fire_gradient_ provider.cycle_period = 3000 return provider end)(engine) var ocean_waves_ = animation.rich_palette_animation(engine) ocean_waves_.palette = ocean_depths_ ocean_waves_.cycle_period = 8000 ocean_waves_.transition_type = animation.SINE ocean_waves_.brightness = 200 var aurora_lights_ = animation.rich_palette_animation(engine) aurora_lights_.palette = aurora_borealis_ aurora_lights_.cycle_period = 12000 aurora_lights_.transition_type = animation.SINE aurora_lights_.brightness = 180 var sunset_glow_ = animation.rich_palette_animation(engine) sunset_glow_.palette = sunset_sky_ sunset_glow_.cycle_period = 6000 sunset_glow_.transition_type = animation.SINE sunset_glow_.brightness = 220 # Sequence to showcase all palettes var palette_showcase_ = animation.SequenceManager(engine) # Fire effect .push_play_step(fire_effect_, 8000) .push_wait_step(1000) # Ocean waves .push_play_step(ocean_waves_, 8000) .push_wait_step(1000) # Aurora borealis .push_play_step(aurora_lights_, 8000) .push_wait_step(1000) # Sunset .push_play_step(sunset_glow_, 8000) .push_wait_step(1000) # Quick cycle through all .push_repeat_subsequence(animation.SequenceManager(engine, 3) .push_play_step(fire_effect_, 2000) .push_play_step(ocean_waves_, 2000) .push_play_step(aurora_lights_, 2000) .push_play_step(sunset_glow_, 2000) ) engine.add(palette_showcase_) engine.run() #- Original DSL source: # Palette Showcase - Demonstrates all palette features # This example shows the full range of palette capabilities #strip length 60 # Example 1: Fire palette with hex colors palette fire_gradient = [ (0, 0x000000), # Black (no fire) (32, 0x330000), # Very dark red (64, 0x660000), # Dark red (96, 0xCC0000), # Red (128, 0xFF3300), # Red-orange (160, 0xFF6600), # Orange (192, 0xFF9900), # Light orange (224, 0xFFCC00), # Yellow-orange (255, 0xFFFF00) # Bright yellow ] # Example 2: Ocean palette with named colors palette ocean_depths = [ (0, black), # Deep ocean (64, navy), # Deep blue (128, blue), # Ocean blue (192, cyan), # Shallow water (255, white) # Foam/waves ] # Example 3: Aurora palette (from the original example) palette aurora_borealis = [ (0, 0x000022), # Dark night sky (64, 0x004400), # Dark green (128, 0x00AA44), # Aurora green (192, 0x44AA88), # Light green (255, 0x88FFAA) # Bright aurora ] # Example 4: Sunset palette mixing hex and named colors palette sunset_sky = [ (0, 0x191970), # Midnight blue (64, purple), # Purple twilight (128, 0xFF69B4), # Hot pink (192, orange), # Sunset orange (255, yellow) # Sun ] # Create animations using each palette animation fire_effect = solid(color=rich_palette(palette=fire_gradient, cycle_period=3s)) animation ocean_waves = rich_palette_animation(palette=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200) animation aurora_lights = rich_palette_animation(palette=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180) animation sunset_glow = rich_palette_animation(palette=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220) # Sequence to showcase all palettes sequence palette_showcase { # Fire effect play fire_effect for 8s wait 1s # Ocean waves play ocean_waves for 8s wait 1s # Aurora borealis play aurora_lights for 8s wait 1s # Sunset play sunset_glow for 8s wait 1s # Quick cycle through all repeat 3 times { play fire_effect for 2s play ocean_waves for 2s play aurora_lights for 2s play sunset_glow for 2s } } run palette_showcase -#