Berry animation remove mandatory commas from DSL (#23821)

This commit is contained in:
s-hadinger 2025-08-24 09:52:51 +02:00 committed by GitHub
parent 123cb8ed79
commit a7cfe701ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 5252 additions and 4598 deletions

View File

@ -23,10 +23,10 @@ palette aurora_purple = [
# Base aurora animation with slow flowing colors
animation aurora_base = rich_palette_animation(
palette=aurora_colors, # palette
cycle_period=10s, # cycle period
transition_type=SINE, # transition type (explicit for clarity)
brightness=180 # brightness (dimmed for aurora effect)
palette=aurora_colors # palette
cycle_period=10s # cycle period
transition_type=SINE # transition type (explicit for clarity)
brightness=180 # brightness (dimmed for aurora effect)
)
sequence demo {

View File

@ -22,16 +22,16 @@ palette breathe_palette = [
# Create a rich palette color provider
color palette_pattern = rich_palette(
palette=breathe_palette, # palette
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
palette=breathe_palette # palette
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
)
# Create breathing animation using the palette
animation breathing = breathe_animation(
color=palette_pattern, # base animation
min_brightness=100, # min brightness
max_brightness=255, # max brightness
period=4s # breathing period (4 seconds)
color=palette_pattern # base animation
min_brightness=100 # min brightness
max_brightness=255 # max brightness
period=4s # breathing period (4 seconds)
)
# Add gentle opacity breathing

View File

@ -19,26 +19,26 @@ palette ornament_colors = [
# Colorful ornaments as twinkling lights
color ornament_pattern = rich_palette(palette=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
animation ornaments = twinkle_animation(
color=ornament_pattern, # color source
density=15, # density (many ornaments)
twinkle_speed=800ms # twinkle speed (slow twinkle)
color=ornament_pattern # color source
density=15 # density (many ornaments)
twinkle_speed=800ms # twinkle speed (slow twinkle)
)
ornaments.priority = 10
# Star on top (bright yellow pulse)
animation tree_star = beacon_animation(
color=0xFFFF00, # Bright yellow
pos=58, # position (near the top)
beacon_size=3, # star size
slew_size=1 # sharp edges
color=0xFFFF00 # Bright yellow
pos=58 # position (near the top)
beacon_size=3 # star size
slew_size=1 # sharp edges
)
tree_star.priority = 20
tree_star.opacity = smooth(min_value=200, max_value=255, duration=2s) # Gentle pulsing
# Add some white sparkles for snow/magic
animation snow_sparkles = twinkle_animation(
color=0xFFFFFF, # White snow
density=8, # density (sparkle count)
color=0xFFFFFF # White snow
density=8 # density (sparkle count)
twinkle_speed=400ms # twinkle speed (quick sparkles)
)
snow_sparkles.priority = 15
@ -46,9 +46,9 @@ snow_sparkles.priority = 15
# Garland effect - moving colored lights
color garland_pattern = rich_palette(palette=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
animation garland = comet_animation(
color=garland_pattern, # color source
tail_length=6, # garland length (tail length)
speed=4s # slow movement (speed)
color=garland_pattern # color source
tail_length=6 # garland length (tail length)
speed=4s # slow movement (speed)
)
garland.priority = 5

View File

@ -9,25 +9,25 @@ animation background = solid(color=space_blue)
# Main comet with bright white head
animation comet_main = comet_animation(
color=0xFFFFFF, # White head
tail_length=10, # tail length
speed=2s # speed
color=0xFFFFFF # White head
tail_length=10 # tail length
speed=2s # speed
)
comet_main.priority = 7
# Secondary comet in different color, opposite direction
animation comet_secondary = comet_animation(
color=0xFF4500, # Orange head
tail_length=8, # shorter tail
speed=3s, # slower speed
direction=-1 # other direction
color=0xFF4500 # Orange head
tail_length=8 # shorter tail
speed=3s # slower speed
direction=-1 # other direction
)
comet_secondary.priority = 5
# Add sparkle trail behind comets but on top of blue background
animation comet_sparkles = twinkle_animation(
color=0xAAAAFF, # Light blue sparkles
density=8, # density (moderate sparkles)
color=0xAAAAFF # Light blue sparkles
density=8 # density (moderate sparkles)
twinkle_speed=400ms # twinkle speed (quick sparkle)
)
comet_sparkles.priority = 8

View File

@ -31,10 +31,10 @@
#
# # Base aurora animation with slow flowing colors
# animation aurora_base = rich_palette_animation(
# palette=aurora_colors, # palette
# cycle_period=10s, # cycle period
# transition_type=SINE, # transition type (explicit for clarity)
# brightness=180 # brightness (dimmed for aurora effect)
# palette=aurora_colors # palette
# cycle_period=10s # cycle period
# transition_type=SINE # transition type (explicit for clarity)
# brightness=180 # brightness (dimmed for aurora effect)
# )
#
# sequence demo {
@ -57,9 +57,9 @@ var aurora_colors_ = bytes("00000022" "40004400" "8000AA44" "C044AA88" "FF88FFAA
var aurora_purple_ = bytes("00220022" "40440044" "808800AA" "C0AA44CC" "FFCCAAFF")
# Base aurora animation with slow flowing colors
var aurora_base_ = animation.rich_palette_animation(engine)
aurora_base_.palette = animation.global('aurora_colors_', 'aurora_colors')
aurora_base_.cycle_period = 10000
aurora_base_.transition_type = animation.global('SINE_', 'SINE')
aurora_base_.palette = animation.global('aurora_colors_', 'aurora_colors') # palette
aurora_base_.cycle_period = 10000 # cycle period
aurora_base_.transition_type = animation.global('SINE_', 'SINE') # transition type (explicit for clarity)
aurora_base_.brightness = 180 # brightness (dimmed for aurora effect)
def sequence_demo()
var steps = []

View File

@ -30,16 +30,16 @@
#
# # Create a rich palette color provider
# color palette_pattern = rich_palette(
# palette=breathe_palette, # palette
# cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
# palette=breathe_palette # palette
# cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
# )
#
# # Create breathing animation using the palette
# animation breathing = breathe_animation(
# color=palette_pattern, # base animation
# min_brightness=100, # min brightness
# max_brightness=255, # max brightness
# period=4s # breathing period (4 seconds)
# color=palette_pattern # base animation
# min_brightness=100 # min brightness
# max_brightness=255 # max brightness
# period=4s # breathing period (4 seconds)
# )
#
# # Add gentle opacity breathing
@ -66,20 +66,20 @@ var breathe_orange_ = 0xFFFF8000
var breathe_palette_ = bytes("00FF0000" "33FF8000" "66FFFF00" "9900FF00" "CC0000FF" "FF800080")
# Create a rich palette color provider
var palette_pattern_ = animation.rich_palette(engine)
palette_pattern_.palette = animation.global('breathe_palette_', 'breathe_palette')
palette_pattern_.palette = animation.global('breathe_palette_', 'breathe_palette') # palette
palette_pattern_.cycle_period = 15000 # cycle period (defaults: smooth transition, 255 brightness)
# Create breathing animation using the palette
var breathing_ = animation.breathe_animation(engine)
breathing_.color = animation.global('palette_pattern_', 'palette_pattern')
breathing_.min_brightness = 100
breathing_.max_brightness = 255
breathing_.color = animation.global('palette_pattern_', 'palette_pattern') # base animation
breathing_.min_brightness = 100 # min brightness
breathing_.max_brightness = 255 # max brightness
breathing_.period = 4000 # breathing period (4 seconds)
# Add gentle opacity breathing
var temp_smooth_156 = animation.smooth(engine)
temp_smooth_156.min_value = 100
temp_smooth_156.max_value = 255
temp_smooth_156.duration = 4000
animation.global('breathing_').opacity = temp_smooth_156
var temp_smooth_152 = animation.smooth(engine)
temp_smooth_152.min_value = 100
temp_smooth_152.max_value = 255
temp_smooth_152.duration = 4000
animation.global('breathing_').opacity = temp_smooth_152
# Start the animation
# Start all animations/sequences
if global.contains('sequence_breathing')

View File

@ -27,26 +27,26 @@
# # Colorful ornaments as twinkling lights
# color ornament_pattern = rich_palette(palette=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
# animation ornaments = twinkle_animation(
# color=ornament_pattern, # color source
# density=15, # density (many ornaments)
# twinkle_speed=800ms # twinkle speed (slow twinkle)
# color=ornament_pattern # color source
# density=15 # density (many ornaments)
# twinkle_speed=800ms # twinkle speed (slow twinkle)
# )
# ornaments.priority = 10
#
# # Star on top (bright yellow pulse)
# animation tree_star = beacon_animation(
# color=0xFFFF00, # Bright yellow
# pos=58, # position (near the top)
# beacon_size=3, # star size
# slew_size=1 # sharp edges
# color=0xFFFF00 # Bright yellow
# pos=58 # position (near the top)
# beacon_size=3 # star size
# slew_size=1 # sharp edges
# )
# tree_star.priority = 20
# tree_star.opacity = smooth(min_value=200, max_value=255, duration=2s) # Gentle pulsing
#
# # Add some white sparkles for snow/magic
# animation snow_sparkles = twinkle_animation(
# color=0xFFFFFF, # White snow
# density=8, # density (sparkle count)
# color=0xFFFFFF # White snow
# density=8 # density (sparkle count)
# twinkle_speed=400ms # twinkle speed (quick sparkles)
# )
# snow_sparkles.priority = 15
@ -54,9 +54,9 @@
# # Garland effect - moving colored lights
# color garland_pattern = rich_palette(palette=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
# animation garland = comet_animation(
# color=garland_pattern, # color source
# tail_length=6, # garland length (tail length)
# speed=4s # slow movement (speed)
# color=garland_pattern # color source
# tail_length=6 # garland length (tail length)
# speed=4s # slow movement (speed)
# )
# garland.priority = 5
#
@ -88,26 +88,26 @@ ornament_pattern_.cycle_period = 3000
ornament_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
ornament_pattern_.brightness = 255
var ornaments_ = animation.twinkle_animation(engine)
ornaments_.color = animation.global('ornament_pattern_', 'ornament_pattern')
ornaments_.density = 15
ornaments_.color = animation.global('ornament_pattern_', 'ornament_pattern') # color source
ornaments_.density = 15 # density (many ornaments)
ornaments_.twinkle_speed = 800 # twinkle speed (slow twinkle)
animation.global('ornaments_').priority = 10
# Star on top (bright yellow pulse)
var tree_star_ = animation.beacon_animation(engine)
tree_star_.color = 0xFFFFFF00
tree_star_.pos = 58
tree_star_.beacon_size = 3
tree_star_.color = 0xFFFFFF00 # Bright yellow
tree_star_.pos = 58 # position (near the top)
tree_star_.beacon_size = 3 # star size
tree_star_.slew_size = 1 # sharp edges
animation.global('tree_star_').priority = 20
var temp_smooth_175 = animation.smooth(engine)
temp_smooth_175.min_value = 200
temp_smooth_175.max_value = 255
temp_smooth_175.duration = 2000
animation.global('tree_star_').opacity = temp_smooth_175 # Gentle pulsing
var temp_smooth_170 = animation.smooth(engine)
temp_smooth_170.min_value = 200
temp_smooth_170.max_value = 255
temp_smooth_170.duration = 2000
animation.global('tree_star_').opacity = temp_smooth_170 # Gentle pulsing
# Add some white sparkles for snow/magic
var snow_sparkles_ = animation.twinkle_animation(engine)
snow_sparkles_.color = 0xFFFFFFFF
snow_sparkles_.density = 8
snow_sparkles_.color = 0xFFFFFFFF # White snow
snow_sparkles_.density = 8 # density (sparkle count)
snow_sparkles_.twinkle_speed = 400 # twinkle speed (quick sparkles)
animation.global('snow_sparkles_').priority = 15
# Garland effect - moving colored lights
@ -117,8 +117,8 @@ garland_pattern_.cycle_period = 2000
garland_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
garland_pattern_.brightness = 200
var garland_ = animation.comet_animation(engine)
garland_.color = animation.global('garland_pattern_', 'garland_pattern')
garland_.tail_length = 6
garland_.color = animation.global('garland_pattern_', 'garland_pattern') # color source
garland_.tail_length = 6 # garland length (tail length)
garland_.speed = 4000 # slow movement (speed)
animation.global('garland_').priority = 5
# Start all animations

View File

@ -17,25 +17,25 @@
#
# # Main comet with bright white head
# animation comet_main = comet_animation(
# color=0xFFFFFF, # White head
# tail_length=10, # tail length
# speed=2s # speed
# color=0xFFFFFF # White head
# tail_length=10 # tail length
# speed=2s # speed
# )
# comet_main.priority = 7
#
# # Secondary comet in different color, opposite direction
# animation comet_secondary = comet_animation(
# color=0xFF4500, # Orange head
# tail_length=8, # shorter tail
# speed=3s, # slower speed
# direction=-1 # other direction
# color=0xFF4500 # Orange head
# tail_length=8 # shorter tail
# speed=3s # slower speed
# direction=-1 # other direction
# )
# comet_secondary.priority = 5
#
# # Add sparkle trail behind comets but on top of blue background
# animation comet_sparkles = twinkle_animation(
# color=0xAAAAFF, # Light blue sparkles
# density=8, # density (moderate sparkles)
# color=0xAAAAFF # Light blue sparkles
# density=8 # density (moderate sparkles)
# twinkle_speed=400ms # twinkle speed (quick sparkle)
# )
# comet_sparkles.priority = 8
@ -60,21 +60,21 @@ var background_ = animation.solid(engine)
background_.color = animation.global('space_blue_', 'space_blue')
# Main comet with bright white head
var comet_main_ = animation.comet_animation(engine)
comet_main_.color = 0xFFFFFFFF
comet_main_.tail_length = 10
comet_main_.color = 0xFFFFFFFF # White head
comet_main_.tail_length = 10 # tail length
comet_main_.speed = 2000 # speed
animation.global('comet_main_').priority = 7
# Secondary comet in different color, opposite direction
var comet_secondary_ = animation.comet_animation(engine)
comet_secondary_.color = 0xFFFF4500
comet_secondary_.tail_length = 8
comet_secondary_.speed = 3000
comet_secondary_.color = 0xFFFF4500 # Orange head
comet_secondary_.tail_length = 8 # shorter tail
comet_secondary_.speed = 3000 # slower speed
comet_secondary_.direction = -1 # other direction
animation.global('comet_secondary_').priority = 5
# Add sparkle trail behind comets but on top of blue background
var comet_sparkles_ = animation.twinkle_animation(engine)
comet_sparkles_.color = 0xFFAAAAFF
comet_sparkles_.density = 8
comet_sparkles_.color = 0xFFAAAAFF # Light blue sparkles
comet_sparkles_.density = 8 # density (moderate sparkles)
comet_sparkles_.twinkle_speed = 400 # twinkle speed (quick sparkle)
animation.global('comet_sparkles_').priority = 8
# Start all animations

View File

@ -36,19 +36,19 @@
# # Add colored sparkles
# color sparkle_pattern = rich_palette(palette=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
# animation disco_sparkles = twinkle_animation(
# color=sparkle_pattern, # color source
# density=12, # density (many sparkles)
# twinkle_speed=80ms # twinkle speed (very quick)
# color=sparkle_pattern # color source
# density=12 # density (many sparkles)
# twinkle_speed=80ms # twinkle speed (very quick)
# )
# disco_sparkles.priority = 15
#
# # Add moving pulse for extra effect
# color pulse_pattern = rich_palette(palette=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
# animation disco_pulse = beacon_animation(
# color=pulse_pattern, # color source
# pos=4, # initial position
# beacon_size=8, # pulse width
# slew_size=2 # sharp edges (slew size)
# color=pulse_pattern # color source
# pos=4 # initial position
# beacon_size=8 # pulse width
# slew_size=2 # sharp edges (slew size)
# )
# disco_pulse.priority = 10
# disco_pulse.pos = sawtooth(min_value=4, max_value=56, duration=2s) # Fast movement
@ -99,8 +99,8 @@ sparkle_pattern_.cycle_period = 500
sparkle_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
sparkle_pattern_.brightness = 255
var disco_sparkles_ = animation.twinkle_animation(engine)
disco_sparkles_.color = animation.global('sparkle_pattern_', 'sparkle_pattern')
disco_sparkles_.density = 12
disco_sparkles_.color = animation.global('sparkle_pattern_', 'sparkle_pattern') # color source
disco_sparkles_.density = 12 # density (many sparkles)
disco_sparkles_.twinkle_speed = 80 # twinkle speed (very quick)
animation.global('disco_sparkles_').priority = 15
# Add moving pulse for extra effect
@ -110,16 +110,16 @@ pulse_pattern_.cycle_period = 800
pulse_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
pulse_pattern_.brightness = 255
var disco_pulse_ = animation.beacon_animation(engine)
disco_pulse_.color = animation.global('pulse_pattern_', 'pulse_pattern')
disco_pulse_.pos = 4
disco_pulse_.beacon_size = 8
disco_pulse_.color = animation.global('pulse_pattern_', 'pulse_pattern') # color source
disco_pulse_.pos = 4 # initial position
disco_pulse_.beacon_size = 8 # pulse width
disco_pulse_.slew_size = 2 # sharp edges (slew size)
animation.global('disco_pulse_').priority = 10
var temp_sawtooth_290 = animation.sawtooth(engine)
temp_sawtooth_290.min_value = 4
temp_sawtooth_290.max_value = 56
temp_sawtooth_290.duration = 2000
animation.global('disco_pulse_').pos = temp_sawtooth_290 # Fast movement
var temp_sawtooth_285 = animation.sawtooth(engine)
temp_sawtooth_285.min_value = 4
temp_sawtooth_285.max_value = 56
temp_sawtooth_285.duration = 2000
animation.global('disco_pulse_').pos = temp_sawtooth_285 # Fast movement
# Start all animations
# Start all animations/sequences
if global.contains('sequence_disco_base')

View File

@ -29,9 +29,9 @@
# # Add subtle position variation for more realism
# color flicker_pattern = rich_palette(palette=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
# animation fire_flicker = twinkle_animation(
# color=flicker_pattern, # color source
# density=12, # density (number of flickers)
# twinkle_speed=200ms # twinkle speed (flicker duration)
# color=flicker_pattern # color source
# density=12 # density (number of flickers)
# twinkle_speed=200ms # twinkle speed (flicker duration)
# )
# fire_flicker.priority = 10
#
@ -68,8 +68,8 @@ flicker_pattern_.cycle_period = 2000
flicker_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
flicker_pattern_.brightness = 255
var fire_flicker_ = animation.twinkle_animation(engine)
fire_flicker_.color = animation.global('flicker_pattern_', 'flicker_pattern')
fire_flicker_.density = 12
fire_flicker_.color = animation.global('flicker_pattern_', 'flicker_pattern') # color source
fire_flicker_.density = 12 # density (number of flickers)
fire_flicker_.twinkle_speed = 200 # twinkle speed (flicker duration)
animation.global('fire_flicker_').priority = 10
# Start both animations

View File

@ -34,10 +34,10 @@
#
# # Add center pulse for emphasis
# animation center_pulse = beacon_animation(
# color=0xFFFFFF, # White center
# pos=30, # center of strip
# beacon_size=4, # small center
# slew_size=2 # soft edges
# color=0xFFFFFF # White center
# pos=30 # center of strip
# beacon_size=4 # small center
# slew_size=2 # soft edges
# )
# center_pulse.priority = 20
# center_pulse.opacity = square(min_value=0, max_value=200, duration=100ms, duty_cycle=10) # Quick white flash
@ -97,17 +97,17 @@ animation.global('heart_glow_').opacity = temp_smooth_136 # Gentle breathing gl
animation.global('heart_glow_').priority = 5
# Add center pulse for emphasis
var center_pulse_ = animation.beacon_animation(engine)
center_pulse_.color = 0xFFFFFFFF
center_pulse_.pos = 30
center_pulse_.beacon_size = 4
center_pulse_.color = 0xFFFFFFFF # White center
center_pulse_.pos = 30 # center of strip
center_pulse_.beacon_size = 4 # small center
center_pulse_.slew_size = 2 # soft edges
animation.global('center_pulse_').priority = 20
var temp_square_202 = animation.square(engine)
temp_square_202.min_value = 0
temp_square_202.max_value = 200
temp_square_202.duration = 100
temp_square_202.duty_cycle = 10
animation.global('center_pulse_').opacity = temp_square_202 # Quick white flash
var temp_square_199 = animation.square(engine)
temp_square_199.min_value = 0
temp_square_199.max_value = 200
temp_square_199.duration = 100
temp_square_199.duty_cycle = 10
animation.global('center_pulse_').opacity = temp_square_199 # Quick white flash
# Start all animations
# Start all animations/sequences
if global.contains('sequence_background')

View File

@ -26,30 +26,30 @@
# # Add slow-moving lava blobs
# color blob1_pattern = rich_palette(palette=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
# animation lava_blob1 = beacon_animation(
# color=blob1_pattern, # color source
# pos=9, # initial position
# beacon_size=18, # large blob
# slew_size=12 # very soft edges
# color=blob1_pattern # color source
# pos=9 # initial position
# beacon_size=18 # large blob
# slew_size=12 # very soft edges
# )
# lava_blob1.priority = 10
# lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
#
# color blob2_pattern = rich_palette(palette=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
# animation lava_blob2 = beacon_animation(
# color=blob2_pattern, # color source
# pos=46, # initial position
# beacon_size=14, # medium blob
# slew_size=10 # soft edges
# color=blob2_pattern # color source
# pos=46 # initial position
# beacon_size=14 # medium blob
# slew_size=10 # soft edges
# )
# lava_blob2.priority = 8
# lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
#
# color blob3_pattern = rich_palette(palette=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
# animation lava_blob3 = beacon_animation(
# color=blob3_pattern, # color source
# pos=25, # initial position
# beacon_size=10, # smaller blob
# slew_size=8 # soft edges
# color=blob3_pattern # color source
# pos=25 # initial position
# beacon_size=10 # smaller blob
# slew_size=8 # soft edges
# )
# lava_blob3.priority = 6
# lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range
@ -57,9 +57,9 @@
# # Add subtle heat shimmer effect
# color shimmer_pattern = rich_palette(palette=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
# animation heat_shimmer = twinkle_animation(
# color=shimmer_pattern, # color source
# density=6, # density (shimmer points)
# twinkle_speed=1.5s # twinkle speed (slow shimmer)
# color=shimmer_pattern # color source
# density=6 # density (shimmer points)
# twinkle_speed=1.5s # twinkle speed (slow shimmer)
# )
# heat_shimmer.priority = 15
#
@ -93,48 +93,48 @@ blob1_pattern_.cycle_period = 12000
blob1_pattern_.transition_type = animation.global('SINE_', 'SINE')
blob1_pattern_.brightness = 255
var lava_blob1_ = animation.beacon_animation(engine)
lava_blob1_.color = animation.global('blob1_pattern_', 'blob1_pattern')
lava_blob1_.pos = 9
lava_blob1_.beacon_size = 18
lava_blob1_.color = animation.global('blob1_pattern_', 'blob1_pattern') # color source
lava_blob1_.pos = 9 # initial position
lava_blob1_.beacon_size = 18 # large blob
lava_blob1_.slew_size = 12 # very soft edges
animation.global('lava_blob1_').priority = 10
var temp_smooth_148 = animation.smooth(engine)
temp_smooth_148.min_value = 9
temp_smooth_148.max_value = 51
temp_smooth_148.duration = 20000
animation.global('lava_blob1_').pos = temp_smooth_148 # Very slow movement
var temp_smooth_145 = animation.smooth(engine)
temp_smooth_145.min_value = 9
temp_smooth_145.max_value = 51
temp_smooth_145.duration = 20000
animation.global('lava_blob1_').pos = temp_smooth_145 # Very slow movement
var blob2_pattern_ = animation.rich_palette(engine)
blob2_pattern_.palette = animation.global('lava_colors_', 'lava_colors')
blob2_pattern_.cycle_period = 10000
blob2_pattern_.transition_type = animation.global('SINE_', 'SINE')
blob2_pattern_.brightness = 220
var lava_blob2_ = animation.beacon_animation(engine)
lava_blob2_.color = animation.global('blob2_pattern_', 'blob2_pattern')
lava_blob2_.pos = 46
lava_blob2_.beacon_size = 14
lava_blob2_.color = animation.global('blob2_pattern_', 'blob2_pattern') # color source
lava_blob2_.pos = 46 # initial position
lava_blob2_.beacon_size = 14 # medium blob
lava_blob2_.slew_size = 10 # soft edges
animation.global('lava_blob2_').priority = 8
var temp_smooth_228 = animation.smooth(engine)
temp_smooth_228.min_value = 46
temp_smooth_228.max_value = 14
temp_smooth_228.duration = 25000
animation.global('lava_blob2_').pos = temp_smooth_228 # Opposite direction, slower
var temp_smooth_222 = animation.smooth(engine)
temp_smooth_222.min_value = 46
temp_smooth_222.max_value = 14
temp_smooth_222.duration = 25000
animation.global('lava_blob2_').pos = temp_smooth_222 # Opposite direction, slower
var blob3_pattern_ = animation.rich_palette(engine)
blob3_pattern_.palette = animation.global('lava_colors_', 'lava_colors')
blob3_pattern_.cycle_period = 8000
blob3_pattern_.transition_type = animation.global('SINE_', 'SINE')
blob3_pattern_.brightness = 200
var lava_blob3_ = animation.beacon_animation(engine)
lava_blob3_.color = animation.global('blob3_pattern_', 'blob3_pattern')
lava_blob3_.pos = 25
lava_blob3_.beacon_size = 10
lava_blob3_.color = animation.global('blob3_pattern_', 'blob3_pattern') # color source
lava_blob3_.pos = 25 # initial position
lava_blob3_.beacon_size = 10 # smaller blob
lava_blob3_.slew_size = 8 # soft edges
animation.global('lava_blob3_').priority = 6
var temp_smooth_308 = animation.smooth(engine)
temp_smooth_308.min_value = 25
temp_smooth_308.max_value = 35
temp_smooth_308.duration = 18000
animation.global('lava_blob3_').pos = temp_smooth_308 # Small movement range
var temp_smooth_299 = animation.smooth(engine)
temp_smooth_299.min_value = 25
temp_smooth_299.max_value = 35
temp_smooth_299.duration = 18000
animation.global('lava_blob3_').pos = temp_smooth_299 # Small movement range
# Add subtle heat shimmer effect
var shimmer_pattern_ = animation.rich_palette(engine)
shimmer_pattern_.palette = animation.global('lava_colors_', 'lava_colors')
@ -142,8 +142,8 @@ shimmer_pattern_.cycle_period = 6000
shimmer_pattern_.transition_type = animation.global('SINE_', 'SINE')
shimmer_pattern_.brightness = 255
var heat_shimmer_ = animation.twinkle_animation(engine)
heat_shimmer_.color = animation.global('shimmer_pattern_', 'shimmer_pattern')
heat_shimmer_.density = 6
heat_shimmer_.color = animation.global('shimmer_pattern_', 'shimmer_pattern') # color source
heat_shimmer_.density = 6 # density (shimmer points)
heat_shimmer_.twinkle_speed = 1500 # twinkle speed (slow shimmer)
animation.global('heat_shimmer_').priority = 15
# Start all animations

View File

@ -27,10 +27,10 @@
#
# # Secondary lightning - partial strip
# animation lightning_partial = beacon_animation(
# color=0xFFFFAA, # Slightly yellow white
# pos=30, # center position
# beacon_size=20, # covers part of strip
# slew_size=5 # soft edges
# color=0xFFFFAA # Slightly yellow white
# pos=30 # center position
# beacon_size=20 # covers part of strip
# slew_size=5 # soft edges
# )
# lightning_partial.priority = 15
# lightning_partial.opacity = square(min_value=0, max_value=200, duration=120ms, duty_cycle=4) # Different timing
@ -42,8 +42,8 @@
#
# # Distant thunder (dim flashes)
# animation distant_flash = twinkle_animation(
# color=0x666699, # Dim blue-white
# density=4, # density (few flashes)
# color=0x666699 # Dim blue-white
# density=4 # density (few flashes)
# twinkle_speed=300ms # twinkle speed (medium duration)
# )
# distant_flash.priority = 5
@ -83,32 +83,32 @@ animation.global('lightning_main_').opacity = temp_square_82 # Quick bright fla
animation.global('lightning_main_').priority = 20
# Secondary lightning - partial strip
var lightning_partial_ = animation.beacon_animation(engine)
lightning_partial_.color = 0xFFFFFFAA
lightning_partial_.pos = 30
lightning_partial_.beacon_size = 20
lightning_partial_.color = 0xFFFFFFAA # Slightly yellow white
lightning_partial_.pos = 30 # center position
lightning_partial_.beacon_size = 20 # covers part of strip
lightning_partial_.slew_size = 5 # soft edges
animation.global('lightning_partial_').priority = 15
var temp_square_152 = animation.square(engine)
temp_square_152.min_value = 0
temp_square_152.max_value = 200
temp_square_152.duration = 120
temp_square_152.duty_cycle = 4
animation.global('lightning_partial_').opacity = temp_square_152 # Different timing
var temp_square_149 = animation.square(engine)
temp_square_149.min_value = 0
temp_square_149.max_value = 200
temp_square_149.duration = 120
temp_square_149.duty_cycle = 4
animation.global('lightning_partial_').opacity = temp_square_149 # Different timing
# Add blue afterglow
var afterglow_ = animation.solid(engine)
afterglow_.color = 0xFF4444FF
# Blue glow
var temp_square_190 = animation.square(engine)
temp_square_190.min_value = 0
temp_square_190.max_value = 80
temp_square_190.duration = 200
temp_square_190.duty_cycle = 8
animation.global('afterglow_').opacity = temp_square_190 # Longer, dimmer glow
var temp_square_187 = animation.square(engine)
temp_square_187.min_value = 0
temp_square_187.max_value = 80
temp_square_187.duration = 200
temp_square_187.duty_cycle = 8
animation.global('afterglow_').opacity = temp_square_187 # Longer, dimmer glow
animation.global('afterglow_').priority = 10
# Distant thunder (dim flashes)
var distant_flash_ = animation.twinkle_animation(engine)
distant_flash_.color = 0xFF666699
distant_flash_.density = 4
distant_flash_.color = 0xFF666699 # Dim blue-white
distant_flash_.density = 4 # density (few flashes)
distant_flash_.twinkle_speed = 300 # twinkle speed (medium duration)
animation.global('distant_flash_').priority = 5
# Start all animations

View File

@ -27,34 +27,34 @@
# # Create multiple cascading streams
# color stream1_pattern = rich_palette(palette=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
# animation stream1 = comet_animation(
# color=stream1_pattern, # color source
# tail_length=15, # long tail
# speed=1.5s, # speed
# color=stream1_pattern # color source
# tail_length=15 # long tail
# speed=1.5s # speed
# priority = 10
# )
#
#
# color stream2_pattern = rich_palette(palette=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
# animation stream2 = comet_animation(
# color=stream2_pattern, # color source
# tail_length=12, # medium tail
# speed=2.2s, # different speed
# color=stream2_pattern # color source
# tail_length=12 # medium tail
# speed=2.2s # different speed
# priority = 8
# )
#
# color stream3_pattern = rich_palette(palette=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
# animation stream3 = comet_animation(
# color=stream3_pattern, # color source
# tail_length=10, # shorter tail
# speed=1.8s, # another speed
# color=stream3_pattern # color source
# tail_length=10 # shorter tail
# speed=1.8s # another speed
# priority = 6
# )
#
# # Add random bright flashes (like code highlights)
# animation code_flash = twinkle_animation(
# color=0x00FFAA, # Bright cyan-green
# density=3, # density (few flashes)
# twinkle_speed=150ms, # twinkle speed (quick flash)
# color=0x00FFAA # Bright cyan-green
# density=3 # density (few flashes)
# twinkle_speed=150ms # twinkle speed (quick flash)
# priority = 20
# )
#
@ -87,9 +87,9 @@ stream1_pattern_.cycle_period = 2000
stream1_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
stream1_pattern_.brightness = 255
var stream1_ = animation.comet_animation(engine)
stream1_.color = animation.global('stream1_pattern_', 'stream1_pattern')
stream1_.tail_length = 15
stream1_.speed = 1500
stream1_.color = animation.global('stream1_pattern_', 'stream1_pattern') # color source
stream1_.tail_length = 15 # long tail
stream1_.speed = 1500 # speed
stream1_.priority = 10
var stream2_pattern_ = animation.rich_palette(engine)
stream2_pattern_.palette = animation.global('matrix_greens_', 'matrix_greens')
@ -97,9 +97,9 @@ stream2_pattern_.cycle_period = 1800
stream2_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
stream2_pattern_.brightness = 200
var stream2_ = animation.comet_animation(engine)
stream2_.color = animation.global('stream2_pattern_', 'stream2_pattern')
stream2_.tail_length = 12
stream2_.speed = 2200
stream2_.color = animation.global('stream2_pattern_', 'stream2_pattern') # color source
stream2_.tail_length = 12 # medium tail
stream2_.speed = 2200 # different speed
stream2_.priority = 8
var stream3_pattern_ = animation.rich_palette(engine)
stream3_pattern_.palette = animation.global('matrix_greens_', 'matrix_greens')
@ -107,15 +107,15 @@ stream3_pattern_.cycle_period = 2500
stream3_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
stream3_pattern_.brightness = 180
var stream3_ = animation.comet_animation(engine)
stream3_.color = animation.global('stream3_pattern_', 'stream3_pattern')
stream3_.tail_length = 10
stream3_.speed = 1800
stream3_.color = animation.global('stream3_pattern_', 'stream3_pattern') # color source
stream3_.tail_length = 10 # shorter tail
stream3_.speed = 1800 # another speed
stream3_.priority = 6
# Add random bright flashes (like code highlights)
var code_flash_ = animation.twinkle_animation(engine)
code_flash_.color = 0xFF00FFAA
code_flash_.density = 3
code_flash_.twinkle_speed = 150
code_flash_.color = 0xFF00FFAA # Bright cyan-green
code_flash_.density = 3 # density (few flashes)
code_flash_.twinkle_speed = 150 # twinkle speed (quick flash)
code_flash_.priority = 20
# Start all animations
# Start all animations/sequences

View File

@ -17,45 +17,45 @@
#
# # Multiple meteors with different speeds and colors
# animation meteor1 = comet_animation(
# color=0xFFFFFF, # Bright white
# tail_length=12, # long trail
# speed=1.5s # fast speed
# color=0xFFFFFF # Bright white
# tail_length=12 # long trail
# speed=1.5s # fast speed
# )
# meteor1.priority = 15
#
# animation meteor2 = comet_animation(
# color=0xFFAA00, # Orange
# tail_length=10, # medium trail
# speed=2s # medium speed
# color=0xFFAA00 # Orange
# tail_length=10 # medium trail
# speed=2s # medium speed
# )
# meteor2.priority = 12
#
# animation meteor3 = comet_animation(
# color=0xAAAAFF, # Blue-white
# tail_length=8, # shorter trail
# speed=1.8s # fast speed
# color=0xAAAAFF # Blue-white
# tail_length=8 # shorter trail
# speed=1.8s # fast speed
# )
# meteor3.priority = 10
#
# animation meteor4 = comet_animation(
# color=0xFFAAAA, # Pink-white
# tail_length=14, # long trail
# speed=2.5s # slower speed
# color=0xFFAAAA # Pink-white
# tail_length=14 # long trail
# speed=2.5s # slower speed
# )
# meteor4.priority = 8
#
# # Add distant stars
# animation stars = twinkle_animation(
# color=0xCCCCCC, # Dim white
# density=12, # density (many stars)
# color=0xCCCCCC # Dim white
# density=12 # density (many stars)
# twinkle_speed=2s # twinkle speed (slow twinkle)
# )
# stars.priority = 5
#
# # Add occasional bright flash (meteor explosion)
# animation meteor_flash = twinkle_animation(
# color=0xFFFFFF, # Bright white
# density=1, # density (single flash)
# color=0xFFFFFF # Bright white
# density=1 # density (single flash)
# twinkle_speed=100ms # twinkle speed (very quick)
# )
# meteor_flash.priority = 25
@ -83,35 +83,35 @@ var background_ = animation.solid(engine)
background_.color = animation.global('space_bg_', 'space_bg')
# Multiple meteors with different speeds and colors
var meteor1_ = animation.comet_animation(engine)
meteor1_.color = 0xFFFFFFFF
meteor1_.tail_length = 12
meteor1_.color = 0xFFFFFFFF # Bright white
meteor1_.tail_length = 12 # long trail
meteor1_.speed = 1500 # fast speed
animation.global('meteor1_').priority = 15
var meteor2_ = animation.comet_animation(engine)
meteor2_.color = 0xFFFFAA00
meteor2_.tail_length = 10
meteor2_.color = 0xFFFFAA00 # Orange
meteor2_.tail_length = 10 # medium trail
meteor2_.speed = 2000 # medium speed
animation.global('meteor2_').priority = 12
var meteor3_ = animation.comet_animation(engine)
meteor3_.color = 0xFFAAAAFF
meteor3_.tail_length = 8
meteor3_.color = 0xFFAAAAFF # Blue-white
meteor3_.tail_length = 8 # shorter trail
meteor3_.speed = 1800 # fast speed
animation.global('meteor3_').priority = 10
var meteor4_ = animation.comet_animation(engine)
meteor4_.color = 0xFFFFAAAA
meteor4_.tail_length = 14
meteor4_.color = 0xFFFFAAAA # Pink-white
meteor4_.tail_length = 14 # long trail
meteor4_.speed = 2500 # slower speed
animation.global('meteor4_').priority = 8
# Add distant stars
var stars_ = animation.twinkle_animation(engine)
stars_.color = 0xFFCCCCCC
stars_.density = 12
stars_.color = 0xFFCCCCCC # Dim white
stars_.density = 12 # density (many stars)
stars_.twinkle_speed = 2000 # twinkle speed (slow twinkle)
animation.global('stars_').priority = 5
# Add occasional bright flash (meteor explosion)
var meteor_flash_ = animation.twinkle_animation(engine)
meteor_flash_.color = 0xFFFFFFFF
meteor_flash_.density = 1
meteor_flash_.color = 0xFFFFFFFF # Bright white
meteor_flash_.density = 1 # density (single flash)
meteor_flash_.twinkle_speed = 100 # twinkle speed (very quick)
animation.global('meteor_flash_').priority = 25
# Start all animations

View File

@ -33,34 +33,34 @@
# # Add neon tube segments with gaps
# color segment_pattern = rich_palette(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
# animation segment1 = beacon_animation(
# color=segment_pattern, # color source
# pos=6, # position
# beacon_size=12, # segment length
# slew_size=1 # sharp edges
# color=segment_pattern # color source
# pos=6 # position
# beacon_size=12 # segment length
# slew_size=1 # sharp edges
# )
# segment1.priority = 10
#
# animation segment2 = beacon_animation(
# color=segment_pattern, # color source
# pos=24, # position
# beacon_size=12, # segment length
# slew_size=1 # sharp edges
# color=segment_pattern # color source
# pos=24 # position
# beacon_size=12 # segment length
# slew_size=1 # sharp edges
# )
# segment2.priority = 10
#
# animation segment3 = beacon_animation(
# color=segment_pattern, # color source
# pos=42, # position
# beacon_size=12, # segment length
# slew_size=1 # sharp edges
# color=segment_pattern # color source
# pos=42 # position
# beacon_size=12 # segment length
# slew_size=1 # sharp edges
# )
# segment3.priority = 10
#
# # Add electrical arcing between segments
# animation arc_sparkles = twinkle_animation(
# color=0xAAAAFF, # Electric blue
# density=4, # density (few arcs)
# twinkle_speed=100ms # twinkle speed (quick arcs)
# color=0xAAAAFF # Electric blue
# density=4 # density (few arcs)
# twinkle_speed=100ms # twinkle speed (quick arcs)
# )
# arc_sparkles.priority = 15
#
@ -112,27 +112,27 @@ segment_pattern_.cycle_period = 4000
segment_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
segment_pattern_.brightness = 255
var segment1_ = animation.beacon_animation(engine)
segment1_.color = animation.global('segment_pattern_', 'segment_pattern')
segment1_.pos = 6
segment1_.beacon_size = 12
segment1_.color = animation.global('segment_pattern_', 'segment_pattern') # color source
segment1_.pos = 6 # position
segment1_.beacon_size = 12 # segment length
segment1_.slew_size = 1 # sharp edges
animation.global('segment1_').priority = 10
var segment2_ = animation.beacon_animation(engine)
segment2_.color = animation.global('segment_pattern_', 'segment_pattern')
segment2_.pos = 24
segment2_.beacon_size = 12
segment2_.color = animation.global('segment_pattern_', 'segment_pattern') # color source
segment2_.pos = 24 # position
segment2_.beacon_size = 12 # segment length
segment2_.slew_size = 1 # sharp edges
animation.global('segment2_').priority = 10
var segment3_ = animation.beacon_animation(engine)
segment3_.color = animation.global('segment_pattern_', 'segment_pattern')
segment3_.pos = 42
segment3_.beacon_size = 12
segment3_.color = animation.global('segment_pattern_', 'segment_pattern') # color source
segment3_.pos = 42 # position
segment3_.beacon_size = 12 # segment length
segment3_.slew_size = 1 # sharp edges
animation.global('segment3_').priority = 10
# Add electrical arcing between segments
var arc_sparkles_ = animation.twinkle_animation(engine)
arc_sparkles_.color = 0xFFAAAAFF
arc_sparkles_.density = 4
arc_sparkles_.color = 0xFFAAAAFF # Electric blue
arc_sparkles_.density = 4 # density (few arcs)
arc_sparkles_.twinkle_speed = 100 # twinkle speed (quick arcs)
animation.global('arc_sparkles_').priority = 15
# Start all animations

View File

@ -26,29 +26,29 @@
# # Add wave motion with moving pulses
# color wave1_pattern = rich_palette(palette=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
# animation wave1 = beacon_animation(
# color=wave1_pattern, # color source
# pos=0, # initial position
# beacon_size=12, # wave width
# slew_size=6 # soft edges
# color=wave1_pattern # color source
# pos=0 # initial position
# beacon_size=12 # wave width
# slew_size=6 # soft edges
# )
# wave1.priority = 10
# wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
#
# color wave2_pattern = rich_palette(palette=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
# animation wave2 = beacon_animation(
# color=wave2_pattern, # color source
# pos=52, # initial position
# beacon_size=8, # smaller wave
# slew_size=4 # soft edges
# color=wave2_pattern # color source
# pos=52 # initial position
# beacon_size=8 # smaller wave
# slew_size=4 # soft edges
# )
# wave2.priority = 8
# wave2.pos = sawtooth(min_value=52, max_value=8, duration=7s) # Opposite direction
#
# # Add foam sparkles
# animation foam = twinkle_animation(
# color=0xFFFFFF, # White foam
# density=6, # density (sparkle count)
# twinkle_speed=300ms # twinkle speed (quick sparkles)
# color=0xFFFFFF # White foam
# density=6 # density (sparkle count)
# twinkle_speed=300ms # twinkle speed (quick sparkles)
# )
# foam.priority = 15
#
@ -81,36 +81,36 @@ wave1_pattern_.cycle_period = 6000
wave1_pattern_.transition_type = animation.global('SINE_', 'SINE')
wave1_pattern_.brightness = 255
var wave1_ = animation.beacon_animation(engine)
wave1_.color = animation.global('wave1_pattern_', 'wave1_pattern')
wave1_.pos = 0
wave1_.beacon_size = 12
wave1_.color = animation.global('wave1_pattern_', 'wave1_pattern') # color source
wave1_.pos = 0 # initial position
wave1_.beacon_size = 12 # wave width
wave1_.slew_size = 6 # soft edges
animation.global('wave1_').priority = 10
var temp_sawtooth_148 = animation.sawtooth(engine)
temp_sawtooth_148.min_value = 0
temp_sawtooth_148.max_value = 48
temp_sawtooth_148.duration = 5000
animation.global('wave1_').pos = temp_sawtooth_148 # 60-12 = 48
var temp_sawtooth_145 = animation.sawtooth(engine)
temp_sawtooth_145.min_value = 0
temp_sawtooth_145.max_value = 48
temp_sawtooth_145.duration = 5000
animation.global('wave1_').pos = temp_sawtooth_145 # 60-12 = 48
var wave2_pattern_ = animation.rich_palette(engine)
wave2_pattern_.palette = animation.global('ocean_colors_', 'ocean_colors')
wave2_pattern_.cycle_period = 4000
wave2_pattern_.transition_type = animation.global('SINE_', 'SINE')
wave2_pattern_.brightness = 180
var wave2_ = animation.beacon_animation(engine)
wave2_.color = animation.global('wave2_pattern_', 'wave2_pattern')
wave2_.pos = 52
wave2_.beacon_size = 8
wave2_.color = animation.global('wave2_pattern_', 'wave2_pattern') # color source
wave2_.pos = 52 # initial position
wave2_.beacon_size = 8 # smaller wave
wave2_.slew_size = 4 # soft edges
animation.global('wave2_').priority = 8
var temp_sawtooth_228 = animation.sawtooth(engine)
temp_sawtooth_228.min_value = 52
temp_sawtooth_228.max_value = 8
temp_sawtooth_228.duration = 7000
animation.global('wave2_').pos = temp_sawtooth_228 # Opposite direction
var temp_sawtooth_222 = animation.sawtooth(engine)
temp_sawtooth_222.min_value = 52
temp_sawtooth_222.max_value = 8
temp_sawtooth_222.duration = 7000
animation.global('wave2_').pos = temp_sawtooth_222 # Opposite direction
# Add foam sparkles
var foam_ = animation.twinkle_animation(engine)
foam_.color = 0xFFFFFFFF
foam_.density = 6
foam_.color = 0xFFFFFFFF # White foam
foam_.density = 6 # density (sparkle count)
foam_.twinkle_speed = 300 # twinkle speed (quick sparkles)
animation.global('foam_').priority = 15
# Start all animations

View File

@ -27,9 +27,9 @@
# # Add multiple wave layers for complexity
# color wave1_pattern = rich_palette(palette=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
# animation plasma_wave1 = beacon_animation(
# color=wave1_pattern, # color source
# pos=0, # initial position
# beacon_size=20, # wide wave
# color=wave1_pattern # color source
# pos=0 # initial position
# beacon_size=20 # wide wave
# slew_size=10 # very smooth
# )
# plasma_wave1.priority = 10
@ -37,9 +37,9 @@
#
# color wave2_pattern = rich_palette(palette=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
# animation plasma_wave2 = beacon_animation(
# color=wave2_pattern, # color source
# pos=45, # initial position
# beacon_size=15, # medium wave
# color=wave2_pattern # color source
# pos=45 # initial position
# beacon_size=15 # medium wave
# slew_size=8 # smooth
# )
# plasma_wave2.priority = 8
@ -47,9 +47,9 @@
#
# color wave3_pattern = rich_palette(palette=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
# animation plasma_wave3 = beacon_animation(
# color=wave3_pattern, # color source
# pos=20, # initial position
# beacon_size=12, # smaller wave
# color=wave3_pattern # color source
# pos=20 # initial position
# beacon_size=12 # smaller wave
# slew_size=6 # smooth
# )
# plasma_wave3.priority = 12
@ -87,54 +87,54 @@ wave1_pattern_.cycle_period = 4000
wave1_pattern_.transition_type = animation.global('SINE_', 'SINE')
wave1_pattern_.brightness = 255
var plasma_wave1_ = animation.beacon_animation(engine)
plasma_wave1_.color = animation.global('wave1_pattern_', 'wave1_pattern')
plasma_wave1_.pos = 0
plasma_wave1_.beacon_size = 20
plasma_wave1_.color = animation.global('wave1_pattern_', 'wave1_pattern') # color source
plasma_wave1_.pos = 0 # initial position
plasma_wave1_.beacon_size = 20 # wide wave
plasma_wave1_.slew_size = 10 # very smooth
animation.global('plasma_wave1_').priority = 10
var temp_smooth_156 = animation.smooth(engine)
temp_smooth_156.min_value = 0
temp_smooth_156.max_value = 40
temp_smooth_156.duration = 8000
animation.global('plasma_wave1_').pos = temp_smooth_156
var temp_smooth_153 = animation.smooth(engine)
temp_smooth_153.min_value = 0
temp_smooth_153.max_value = 40
temp_smooth_153.duration = 8000
animation.global('plasma_wave1_').pos = temp_smooth_153
var wave2_pattern_ = animation.rich_palette(engine)
wave2_pattern_.palette = animation.global('plasma_colors_', 'plasma_colors')
wave2_pattern_.cycle_period = 5000
wave2_pattern_.transition_type = animation.global('SINE_', 'SINE')
wave2_pattern_.brightness = 180
var plasma_wave2_ = animation.beacon_animation(engine)
plasma_wave2_.color = animation.global('wave2_pattern_', 'wave2_pattern')
plasma_wave2_.pos = 45
plasma_wave2_.beacon_size = 15
plasma_wave2_.color = animation.global('wave2_pattern_', 'wave2_pattern') # color source
plasma_wave2_.pos = 45 # initial position
plasma_wave2_.beacon_size = 15 # medium wave
plasma_wave2_.slew_size = 8 # smooth
animation.global('plasma_wave2_').priority = 8
var temp_smooth_235 = animation.smooth(engine)
temp_smooth_235.min_value = 45
temp_smooth_235.max_value = 15
temp_smooth_235.duration = 10000
animation.global('plasma_wave2_').pos = temp_smooth_235 # Opposite direction
var temp_smooth_229 = animation.smooth(engine)
temp_smooth_229.min_value = 45
temp_smooth_229.max_value = 15
temp_smooth_229.duration = 10000
animation.global('plasma_wave2_').pos = temp_smooth_229 # Opposite direction
var wave3_pattern_ = animation.rich_palette(engine)
wave3_pattern_.palette = animation.global('plasma_colors_', 'plasma_colors')
wave3_pattern_.cycle_period = 3000
wave3_pattern_.transition_type = animation.global('SINE_', 'SINE')
wave3_pattern_.brightness = 220
var plasma_wave3_ = animation.beacon_animation(engine)
plasma_wave3_.color = animation.global('wave3_pattern_', 'wave3_pattern')
plasma_wave3_.pos = 20
plasma_wave3_.beacon_size = 12
plasma_wave3_.color = animation.global('wave3_pattern_', 'wave3_pattern') # color source
plasma_wave3_.pos = 20 # initial position
plasma_wave3_.beacon_size = 12 # smaller wave
plasma_wave3_.slew_size = 6 # smooth
animation.global('plasma_wave3_').priority = 12
var temp_smooth_315 = animation.smooth(engine)
temp_smooth_315.min_value = 20
temp_smooth_315.max_value = 50
temp_smooth_315.duration = 6000
animation.global('plasma_wave3_').pos = temp_smooth_315 # Different speed
var temp_smooth_306 = animation.smooth(engine)
temp_smooth_306.min_value = 20
temp_smooth_306.max_value = 50
temp_smooth_306.duration = 6000
animation.global('plasma_wave3_').pos = temp_smooth_306 # Different speed
# Add subtle intensity variation
var temp_smooth_338 = animation.smooth(engine)
temp_smooth_338.min_value = 150
temp_smooth_338.max_value = 255
temp_smooth_338.duration = 12000
animation.global('plasma_base_').opacity = temp_smooth_338
var temp_smooth_329 = animation.smooth(engine)
temp_smooth_329.min_value = 150
temp_smooth_329.max_value = 255
temp_smooth_329.duration = 12000
animation.global('plasma_base_').opacity = temp_smooth_329
# Start all animations
# Start all animations/sequences
if global.contains('sequence_plasma_base')

View File

@ -16,20 +16,20 @@
#
# # Left side red flashing
# animation left_red = beacon_animation(
# color=0xFF0000, # Bright red
# pos=15, # center of left half
# beacon_size=15, # half the strip
# slew_size=2 # sharp edges
# color=0xFF0000 # Bright red
# pos=15 # center of left half
# beacon_size=15 # half the strip
# slew_size=2 # sharp edges
# )
# left_red.priority = 10
# left_red.opacity = square(min_value=0, max_value=255, duration=400ms, duty_cycle=50) # 50% duty cycle
#
# # Right side blue flashing (opposite phase)
# animation right_blue = beacon_animation(
# color=0x0000FF, # Bright blue
# pos=45, # center of right half
# beacon_size=15, # half the strip
# slew_size=2 # sharp edges
# color=0x0000FF # Bright blue
# pos=45 # center of right half
# beacon_size=15 # half the strip
# slew_size=2 # sharp edges
# )
# right_blue.priority = 10
# right_blue.opacity = square(min_value=255, max_value=0, duration=400ms, duty_cycle=50) # Opposite phase
@ -56,39 +56,39 @@ var engine = animation.init_strip()
var half_length_ = 30
# Left side red flashing
var left_red_ = animation.beacon_animation(engine)
left_red_.color = 0xFFFF0000
left_red_.pos = 15
left_red_.beacon_size = 15
left_red_.color = 0xFFFF0000 # Bright red
left_red_.pos = 15 # center of left half
left_red_.beacon_size = 15 # half the strip
left_red_.slew_size = 2 # sharp edges
animation.global('left_red_').priority = 10
var temp_square_60 = animation.square(engine)
temp_square_60.min_value = 0
temp_square_60.max_value = 255
temp_square_60.duration = 400
temp_square_60.duty_cycle = 50
animation.global('left_red_').opacity = temp_square_60 # 50% duty cycle
var temp_square_57 = animation.square(engine)
temp_square_57.min_value = 0
temp_square_57.max_value = 255
temp_square_57.duration = 400
temp_square_57.duty_cycle = 50
animation.global('left_red_').opacity = temp_square_57 # 50% duty cycle
# Right side blue flashing (opposite phase)
var right_blue_ = animation.beacon_animation(engine)
right_blue_.color = 0xFF0000FF
right_blue_.pos = 45
right_blue_.beacon_size = 15
right_blue_.color = 0xFF0000FF # Bright blue
right_blue_.pos = 45 # center of right half
right_blue_.beacon_size = 15 # half the strip
right_blue_.slew_size = 2 # sharp edges
animation.global('right_blue_').priority = 10
var temp_square_124 = animation.square(engine)
temp_square_124.min_value = 255
temp_square_124.max_value = 0
temp_square_124.duration = 400
temp_square_124.duty_cycle = 50
animation.global('right_blue_').opacity = temp_square_124 # Opposite phase
var temp_square_118 = animation.square(engine)
temp_square_118.min_value = 255
temp_square_118.max_value = 0
temp_square_118.duration = 400
temp_square_118.duty_cycle = 50
animation.global('right_blue_').opacity = temp_square_118 # Opposite phase
# Add white strobe overlay occasionally
var white_strobe_ = animation.solid(engine)
white_strobe_.color = 0xFFFFFFFF
var temp_square_161 = animation.square(engine)
temp_square_161.min_value = 0
temp_square_161.max_value = 255
temp_square_161.duration = 100
temp_square_161.duty_cycle = 5
animation.global('white_strobe_').opacity = temp_square_161 # Quick bright flashes
var temp_square_155 = animation.square(engine)
temp_square_155.min_value = 0
temp_square_155.max_value = 255
temp_square_155.duration = 100
temp_square_155.duty_cycle = 5
animation.global('white_strobe_').opacity = temp_square_155 # Quick bright flashes
animation.global('white_strobe_').priority = 20
# Start all animations
# Start all animations/sequences

View File

@ -13,7 +13,7 @@
#
# # Create smooth rainbow cycle animation
# color rainbow_cycle = color_cycle(
# palette=[0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8000FF, 0xFF00FF], # rainbow colors
# palette=[0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8000FF, 0xFF00FF] # rainbow colors
# cycle_period=5s # cycle period
# )
# animation rainbow_animation = solid(color=rainbow_cycle)
@ -31,7 +31,7 @@ import animation
var engine = animation.init_strip()
var rainbow_cycle_ = animation.color_cycle(engine)
rainbow_cycle_.palette = [0xFFFF0000, 0xFFFF8000, 0xFFFFFF00, 0xFF00FF00, 0xFF0000FF, 0xFF8000FF, 0xFFFF00FF]
rainbow_cycle_.palette = [0xFFFF0000, 0xFFFF8000, 0xFFFFFF00, 0xFF00FF00, 0xFF0000FF, 0xFF8000FF, 0xFFFF00FF] # rainbow colors
rainbow_cycle_.cycle_period = 5000 # cycle period
var rainbow_animation_ = animation.solid(engine)
rainbow_animation_.color = animation.global('rainbow_cycle_', 'rainbow_cycle')

View File

@ -0,0 +1,55 @@
#!/usr/bin/env berry
# Test runner for compiled DSL examples
# Generated automatically by compile_dsl_examples.be
import os
import sys
# Add animation library path
sys.path().push("lib/libesp32/berry_animation/src")
# Import animation framework
import animation
import animation_dsl
def run_compiled_example(filename)
print(f"Running {filename}...")
try
var f = open(f"lib/libesp32/berry_animation/anim_examples/compiled/{filename}", "r")
var code = f.read()
f.close()
var compiled_func = compile(code)
if compiled_func != nil
compiled_func()
print(f" ✓ {filename} executed successfully")
return true
else
print(f" ✗ {filename} failed to compile")
return false
end
except .. as e, msg
print(f" ✗ {filename} execution failed: {msg}")
return false
end
end
def run_all_examples()
var files = os.listdir("lib/libesp32/berry_animation/anim_examples/compiled")
var success_count = 0
var total_count = 0
for file : files
if string.endswith(file, ".be")
total_count += 1
if run_compiled_example(file)
success_count += 1
end
end
end
print(f"\nTest Results: {success_count}/{total_count} examples ran successfully")
end
# Run all examples if script is executed directly
run_all_examples()

View File

@ -17,10 +17,10 @@
#
# # Main scanner pulse that bounces
# animation scanner = beacon_animation(
# color=0xFF0000, # Bright red
# pos=2, # initial position
# beacon_size=3, # pulse width
# slew_size=2 # fade region
# color=0xFF0000 # Bright red
# pos=2 # initial position
# beacon_size=3 # pulse width
# slew_size=2 # fade region
# )
# scanner.priority = 10
#
@ -29,10 +29,10 @@
#
# # Add trailing glow effect
# animation scanner_trail = beacon_animation(
# color=0x660000, # Dim red trail
# pos=2, # initial position
# beacon_size=6, # wider trail
# slew_size=4 # more fade
# color=0x660000 # Dim red trail
# pos=2 # initial position
# beacon_size=6 # wider trail
# slew_size=4 # more fade
# )
# scanner_trail.priority = 5
# set pos_test = triangle(min_value=2, max_value=57, duration=2s)
@ -58,29 +58,29 @@ var background_ = animation.solid(engine)
background_.color = animation.global('scanner_bg_', 'scanner_bg')
# Main scanner pulse that bounces
var scanner_ = animation.beacon_animation(engine)
scanner_.color = 0xFFFF0000
scanner_.pos = 2
scanner_.beacon_size = 3
scanner_.color = 0xFFFF0000 # Bright red
scanner_.pos = 2 # initial position
scanner_.beacon_size = 3 # pulse width
scanner_.slew_size = 2 # fade region
animation.global('scanner_').priority = 10
# Bouncing position from left to right and back
var temp_triangle_73 = animation.triangle(engine)
temp_triangle_73.min_value = 2
temp_triangle_73.max_value = 57
temp_triangle_73.duration = 2000
animation.global('scanner_').pos = temp_triangle_73
var temp_triangle_70 = animation.triangle(engine)
temp_triangle_70.min_value = 2
temp_triangle_70.max_value = 57
temp_triangle_70.duration = 2000
animation.global('scanner_').pos = temp_triangle_70
# Add trailing glow effect
var scanner_trail_ = animation.beacon_animation(engine)
scanner_trail_.color = 0xFF660000
scanner_trail_.pos = 2
scanner_trail_.beacon_size = 6
scanner_trail_.color = 0xFF660000 # Dim red trail
scanner_trail_.pos = 2 # initial position
scanner_trail_.beacon_size = 6 # wider trail
scanner_trail_.slew_size = 4 # more fade
animation.global('scanner_trail_').priority = 5
var temp_triangle_131 = animation.triangle(engine)
temp_triangle_131.min_value = 2
temp_triangle_131.max_value = 57
temp_triangle_131.duration = 2000
var pos_test_ = temp_triangle_131
var temp_triangle_125 = animation.triangle(engine)
temp_triangle_125.min_value = 2
temp_triangle_125.max_value = 57
temp_triangle_125.duration = 2000
var pos_test_ = temp_triangle_125
animation.global('scanner_trail_').pos = animation.global('pos_test_', 'pos_test')
animation.global('scanner_trail_').opacity = 128 # Half brightness
# Start all animations

View File

@ -29,10 +29,10 @@
#
# # Add sun position effect - bright spot that moves
# animation sun_position = beacon_animation(
# color=0xFFFFAA, # Bright yellow sun
# pos=5, # initial position
# beacon_size=8, # sun size
# slew_size=4 # soft glow
# color=0xFFFFAA # Bright yellow sun
# pos=5 # initial position
# beacon_size=8 # sun size
# slew_size=4 # soft glow
# )
# sun_position.priority = 10
# sun_position.pos = smooth(min_value=5, max_value=55, duration=30s) # Sun arc across sky
@ -40,10 +40,10 @@
#
# # Add atmospheric glow around sun
# animation sun_glow = beacon_animation(
# color=0xFFCC88, # Warm glow
# pos=5, # initial position
# beacon_size=16, # larger glow
# slew_size=8 # very soft
# color=0xFFCC88 # Warm glow
# pos=5 # initial position
# beacon_size=16 # larger glow
# slew_size=8 # very soft
# )
# sun_glow.priority = 5
# sun_glow.pos = smooth(min_value=5, max_value=55, duration=30s) # Follow sun
@ -51,8 +51,8 @@
#
# # Add twinkling stars during night phases
# animation stars = twinkle_animation(
# color=0xFFFFFF, # White stars
# density=6, # density (star count)
# color=0xFFFFFF # White stars
# density=6 # density (star count)
# twinkle_speed=1s # twinkle speed (slow twinkle)
# )
# stars.priority = 15
@ -80,49 +80,49 @@ daylight_cycle_.palette = animation.global('daylight_colors_', 'daylight_colors'
daylight_cycle_.cycle_period = 60000
# Add sun position effect - bright spot that moves
var sun_position_ = animation.beacon_animation(engine)
sun_position_.color = 0xFFFFFFAA
sun_position_.pos = 5
sun_position_.beacon_size = 8
sun_position_.color = 0xFFFFFFAA # Bright yellow sun
sun_position_.pos = 5 # initial position
sun_position_.beacon_size = 8 # sun size
sun_position_.slew_size = 4 # soft glow
animation.global('sun_position_').priority = 10
var temp_smooth_150 = animation.smooth(engine)
temp_smooth_150.min_value = 5
temp_smooth_150.max_value = 55
temp_smooth_150.duration = 30000
animation.global('sun_position_').pos = temp_smooth_150 # Sun arc across sky
var temp_smooth_170 = animation.smooth(engine)
temp_smooth_170.min_value = 0
temp_smooth_170.max_value = 255
temp_smooth_170.duration = 30000
animation.global('sun_position_').opacity = temp_smooth_170 # Fade in and out
var temp_smooth_147 = animation.smooth(engine)
temp_smooth_147.min_value = 5
temp_smooth_147.max_value = 55
temp_smooth_147.duration = 30000
animation.global('sun_position_').pos = temp_smooth_147 # Sun arc across sky
var temp_smooth_167 = animation.smooth(engine)
temp_smooth_167.min_value = 0
temp_smooth_167.max_value = 255
temp_smooth_167.duration = 30000
animation.global('sun_position_').opacity = temp_smooth_167 # Fade in and out
# Add atmospheric glow around sun
var sun_glow_ = animation.beacon_animation(engine)
sun_glow_.color = 0xFFFFCC88
sun_glow_.pos = 5
sun_glow_.beacon_size = 16
sun_glow_.color = 0xFFFFCC88 # Warm glow
sun_glow_.pos = 5 # initial position
sun_glow_.beacon_size = 16 # larger glow
sun_glow_.slew_size = 8 # very soft
animation.global('sun_glow_').priority = 5
var temp_smooth_230 = animation.smooth(engine)
temp_smooth_230.min_value = 5
temp_smooth_230.max_value = 55
temp_smooth_230.duration = 30000
animation.global('sun_glow_').pos = temp_smooth_230 # Follow sun
var temp_smooth_250 = animation.smooth(engine)
temp_smooth_250.min_value = 0
temp_smooth_250.max_value = 150
temp_smooth_250.duration = 30000
animation.global('sun_glow_').opacity = temp_smooth_250 # Dimmer glow
var temp_smooth_224 = animation.smooth(engine)
temp_smooth_224.min_value = 5
temp_smooth_224.max_value = 55
temp_smooth_224.duration = 30000
animation.global('sun_glow_').pos = temp_smooth_224 # Follow sun
var temp_smooth_244 = animation.smooth(engine)
temp_smooth_244.min_value = 0
temp_smooth_244.max_value = 150
temp_smooth_244.duration = 30000
animation.global('sun_glow_').opacity = temp_smooth_244 # Dimmer glow
# Add twinkling stars during night phases
var stars_ = animation.twinkle_animation(engine)
stars_.color = 0xFFFFFFFF
stars_.density = 6
stars_.color = 0xFFFFFFFF # White stars
stars_.density = 6 # density (star count)
stars_.twinkle_speed = 1000 # twinkle speed (slow twinkle)
animation.global('stars_').priority = 15
var temp_smooth_304 = animation.smooth(engine)
temp_smooth_304.min_value = 255
temp_smooth_304.max_value = 0
temp_smooth_304.duration = 30000
animation.global('stars_').opacity = temp_smooth_304 # Fade out during day
var temp_smooth_296 = animation.smooth(engine)
temp_smooth_296.min_value = 255
temp_smooth_296.max_value = 0
temp_smooth_296.duration = 30000
animation.global('stars_').opacity = temp_smooth_296 # Fade out during day
# Start all animations
# Start all animations/sequences
if global.contains('sequence_daylight_cycle')

View File

@ -17,16 +17,16 @@
#
# # White twinkling stars
# animation stars = twinkle_animation(
# color=0xFFFFFF, # White stars
# density=8, # density (number of stars)
# color=0xFFFFFF # White stars
# density=8 # density (number of stars)
# twinkle_speed=500ms # twinkle speed (twinkle duration)
# )
# stars.priority = 10
#
# # Add occasional bright flash
# animation bright_flash = twinkle_animation(
# color=0xFFFFAA, # Bright yellow-white
# density=2, # density (fewer bright flashes)
# color=0xFFFFAA # Bright yellow-white
# density=2 # density (fewer bright flashes)
# twinkle_speed=300ms # twinkle speed (quick flash)
# )
# bright_flash.priority = 15
@ -50,14 +50,14 @@ var background_ = animation.solid(engine)
background_.color = animation.global('night_sky_', 'night_sky')
# White twinkling stars
var stars_ = animation.twinkle_animation(engine)
stars_.color = 0xFFFFFFFF
stars_.density = 8
stars_.color = 0xFFFFFFFF # White stars
stars_.density = 8 # density (number of stars)
stars_.twinkle_speed = 500 # twinkle speed (twinkle duration)
animation.global('stars_').priority = 10
# Add occasional bright flash
var bright_flash_ = animation.twinkle_animation(engine)
bright_flash_.color = 0xFFFFFFAA
bright_flash_.density = 2
bright_flash_.color = 0xFFFFFFAA # Bright yellow-white
bright_flash_.density = 2 # density (fewer bright flashes)
bright_flash_.twinkle_speed = 300 # twinkle speed (quick flash)
animation.global('bright_flash_').priority = 15
# Start all animations

View File

@ -28,19 +28,19 @@ white_flash.priority = 20
# Add colored sparkles
color sparkle_pattern = rich_palette(palette=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
animation disco_sparkles = twinkle_animation(
color=sparkle_pattern, # color source
density=12, # density (many sparkles)
twinkle_speed=80ms # twinkle speed (very quick)
color=sparkle_pattern # color source
density=12 # density (many sparkles)
twinkle_speed=80ms # twinkle speed (very quick)
)
disco_sparkles.priority = 15
# Add moving pulse for extra effect
color pulse_pattern = rich_palette(palette=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
animation disco_pulse = beacon_animation(
color=pulse_pattern, # color source
pos=4, # initial position
beacon_size=8, # pulse width
slew_size=2 # sharp edges (slew size)
color=pulse_pattern # color source
pos=4 # initial position
beacon_size=8 # pulse width
slew_size=2 # sharp edges (slew size)
)
disco_pulse.priority = 10
disco_pulse.pos = sawtooth(min_value=4, max_value=56, duration=2s) # Fast movement

View File

@ -21,9 +21,9 @@ fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
# Add subtle position variation for more realism
color flicker_pattern = rich_palette(palette=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
animation fire_flicker = twinkle_animation(
color=flicker_pattern, # color source
density=12, # density (number of flickers)
twinkle_speed=200ms # twinkle speed (flicker duration)
color=flicker_pattern # color source
density=12 # density (number of flickers)
twinkle_speed=200ms # twinkle speed (flicker duration)
)
fire_flicker.priority = 10

View File

@ -26,10 +26,10 @@ heart_glow.priority = 5
# Add center pulse for emphasis
animation center_pulse = beacon_animation(
color=0xFFFFFF, # White center
pos=30, # center of strip
beacon_size=4, # small center
slew_size=2 # soft edges
color=0xFFFFFF # White center
pos=30 # center of strip
beacon_size=4 # small center
slew_size=2 # soft edges
)
center_pulse.priority = 20
center_pulse.opacity = square(min_value=0, max_value=200, duration=100ms, duty_cycle=10) # Quick white flash

View File

@ -18,30 +18,30 @@ animation lava_base = rich_palette_animation(palette=lava_colors, cycle_period=1
# Add slow-moving lava blobs
color blob1_pattern = rich_palette(palette=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
animation lava_blob1 = beacon_animation(
color=blob1_pattern, # color source
pos=9, # initial position
beacon_size=18, # large blob
slew_size=12 # very soft edges
color=blob1_pattern # color source
pos=9 # initial position
beacon_size=18 # large blob
slew_size=12 # very soft edges
)
lava_blob1.priority = 10
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
color blob2_pattern = rich_palette(palette=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
animation lava_blob2 = beacon_animation(
color=blob2_pattern, # color source
pos=46, # initial position
beacon_size=14, # medium blob
slew_size=10 # soft edges
color=blob2_pattern # color source
pos=46 # initial position
beacon_size=14 # medium blob
slew_size=10 # soft edges
)
lava_blob2.priority = 8
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
color blob3_pattern = rich_palette(palette=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
animation lava_blob3 = beacon_animation(
color=blob3_pattern, # color source
pos=25, # initial position
beacon_size=10, # smaller blob
slew_size=8 # soft edges
color=blob3_pattern # color source
pos=25 # initial position
beacon_size=10 # smaller blob
slew_size=8 # soft edges
)
lava_blob3.priority = 6
lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range
@ -49,9 +49,9 @@ lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movem
# Add subtle heat shimmer effect
color shimmer_pattern = rich_palette(palette=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
animation heat_shimmer = twinkle_animation(
color=shimmer_pattern, # color source
density=6, # density (shimmer points)
twinkle_speed=1.5s # twinkle speed (slow shimmer)
color=shimmer_pattern # color source
density=6 # density (shimmer points)
twinkle_speed=1.5s # twinkle speed (slow shimmer)
)
heat_shimmer.priority = 15

View File

@ -19,10 +19,10 @@ lightning_main.priority = 20
# Secondary lightning - partial strip
animation lightning_partial = beacon_animation(
color=0xFFFFAA, # Slightly yellow white
pos=30, # center position
beacon_size=20, # covers part of strip
slew_size=5 # soft edges
color=0xFFFFAA # Slightly yellow white
pos=30 # center position
beacon_size=20 # covers part of strip
slew_size=5 # soft edges
)
lightning_partial.priority = 15
lightning_partial.opacity = square(min_value=0, max_value=200, duration=120ms, duty_cycle=4) # Different timing
@ -34,8 +34,8 @@ afterglow.priority = 10
# Distant thunder (dim flashes)
animation distant_flash = twinkle_animation(
color=0x666699, # Dim blue-white
density=4, # density (few flashes)
color=0x666699 # Dim blue-white
density=4 # density (few flashes)
twinkle_speed=300ms # twinkle speed (medium duration)
)
distant_flash.priority = 5

View File

@ -19,34 +19,34 @@ palette matrix_greens = [
# Create multiple cascading streams
color stream1_pattern = rich_palette(palette=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
animation stream1 = comet_animation(
color=stream1_pattern, # color source
tail_length=15, # long tail
speed=1.5s, # speed
color=stream1_pattern # color source
tail_length=15 # long tail
speed=1.5s # speed
priority = 10
)
color stream2_pattern = rich_palette(palette=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
animation stream2 = comet_animation(
color=stream2_pattern, # color source
tail_length=12, # medium tail
speed=2.2s, # different speed
color=stream2_pattern # color source
tail_length=12 # medium tail
speed=2.2s # different speed
priority = 8
)
color stream3_pattern = rich_palette(palette=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
animation stream3 = comet_animation(
color=stream3_pattern, # color source
tail_length=10, # shorter tail
speed=1.8s, # another speed
color=stream3_pattern # color source
tail_length=10 # shorter tail
speed=1.8s # another speed
priority = 6
)
# Add random bright flashes (like code highlights)
animation code_flash = twinkle_animation(
color=0x00FFAA, # Bright cyan-green
density=3, # density (few flashes)
twinkle_speed=150ms, # twinkle speed (quick flash)
color=0x00FFAA # Bright cyan-green
density=3 # density (few flashes)
twinkle_speed=150ms # twinkle speed (quick flash)
priority = 20
)

View File

@ -9,45 +9,45 @@ animation background = solid(color=space_bg)
# Multiple meteors with different speeds and colors
animation meteor1 = comet_animation(
color=0xFFFFFF, # Bright white
tail_length=12, # long trail
speed=1.5s # fast speed
color=0xFFFFFF # Bright white
tail_length=12 # long trail
speed=1.5s # fast speed
)
meteor1.priority = 15
animation meteor2 = comet_animation(
color=0xFFAA00, # Orange
tail_length=10, # medium trail
speed=2s # medium speed
color=0xFFAA00 # Orange
tail_length=10 # medium trail
speed=2s # medium speed
)
meteor2.priority = 12
animation meteor3 = comet_animation(
color=0xAAAAFF, # Blue-white
tail_length=8, # shorter trail
speed=1.8s # fast speed
color=0xAAAAFF # Blue-white
tail_length=8 # shorter trail
speed=1.8s # fast speed
)
meteor3.priority = 10
animation meteor4 = comet_animation(
color=0xFFAAAA, # Pink-white
tail_length=14, # long trail
speed=2.5s # slower speed
color=0xFFAAAA # Pink-white
tail_length=14 # long trail
speed=2.5s # slower speed
)
meteor4.priority = 8
# Add distant stars
animation stars = twinkle_animation(
color=0xCCCCCC, # Dim white
density=12, # density (many stars)
color=0xCCCCCC # Dim white
density=12 # density (many stars)
twinkle_speed=2s # twinkle speed (slow twinkle)
)
stars.priority = 5
# Add occasional bright flash (meteor explosion)
animation meteor_flash = twinkle_animation(
color=0xFFFFFF, # Bright white
density=1, # density (single flash)
color=0xFFFFFF # Bright white
density=1 # density (single flash)
twinkle_speed=100ms # twinkle speed (very quick)
)
meteor_flash.priority = 25

View File

@ -25,34 +25,34 @@ neon_surge.priority = 20
# Add neon tube segments with gaps
color segment_pattern = rich_palette(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
animation segment1 = beacon_animation(
color=segment_pattern, # color source
pos=6, # position
beacon_size=12, # segment length
slew_size=1 # sharp edges
color=segment_pattern # color source
pos=6 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment1.priority = 10
animation segment2 = beacon_animation(
color=segment_pattern, # color source
pos=24, # position
beacon_size=12, # segment length
slew_size=1 # sharp edges
color=segment_pattern # color source
pos=24 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment2.priority = 10
animation segment3 = beacon_animation(
color=segment_pattern, # color source
pos=42, # position
beacon_size=12, # segment length
slew_size=1 # sharp edges
color=segment_pattern # color source
pos=42 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment3.priority = 10
# Add electrical arcing between segments
animation arc_sparkles = twinkle_animation(
color=0xAAAAFF, # Electric blue
density=4, # density (few arcs)
twinkle_speed=100ms # twinkle speed (quick arcs)
color=0xAAAAFF # Electric blue
density=4 # density (few arcs)
twinkle_speed=100ms # twinkle speed (quick arcs)
)
arc_sparkles.priority = 15

View File

@ -18,29 +18,29 @@ animation ocean_base = rich_palette_animation(palette=ocean_colors, cycle_period
# Add wave motion with moving pulses
color wave1_pattern = rich_palette(palette=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
animation wave1 = beacon_animation(
color=wave1_pattern, # color source
pos=0, # initial position
beacon_size=12, # wave width
slew_size=6 # soft edges
color=wave1_pattern # color source
pos=0 # initial position
beacon_size=12 # wave width
slew_size=6 # soft edges
)
wave1.priority = 10
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
color wave2_pattern = rich_palette(palette=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
animation wave2 = beacon_animation(
color=wave2_pattern, # color source
pos=52, # initial position
beacon_size=8, # smaller wave
slew_size=4 # soft edges
color=wave2_pattern # color source
pos=52 # initial position
beacon_size=8 # smaller wave
slew_size=4 # soft edges
)
wave2.priority = 8
wave2.pos = sawtooth(min_value=52, max_value=8, duration=7s) # Opposite direction
# Add foam sparkles
animation foam = twinkle_animation(
color=0xFFFFFF, # White foam
density=6, # density (sparkle count)
twinkle_speed=300ms # twinkle speed (quick sparkles)
color=0xFFFFFF # White foam
density=6 # density (sparkle count)
twinkle_speed=300ms # twinkle speed (quick sparkles)
)
foam.priority = 15

View File

@ -19,9 +19,9 @@ animation plasma_base = rich_palette_animation(palette=plasma_colors, cycle_peri
# Add multiple wave layers for complexity
color wave1_pattern = rich_palette(palette=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
animation plasma_wave1 = beacon_animation(
color=wave1_pattern, # color source
pos=0, # initial position
beacon_size=20, # wide wave
color=wave1_pattern # color source
pos=0 # initial position
beacon_size=20 # wide wave
slew_size=10 # very smooth
)
plasma_wave1.priority = 10
@ -29,9 +29,9 @@ plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s)
color wave2_pattern = rich_palette(palette=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
animation plasma_wave2 = beacon_animation(
color=wave2_pattern, # color source
pos=45, # initial position
beacon_size=15, # medium wave
color=wave2_pattern # color source
pos=45 # initial position
beacon_size=15 # medium wave
slew_size=8 # smooth
)
plasma_wave2.priority = 8
@ -39,9 +39,9 @@ plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite
color wave3_pattern = rich_palette(palette=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
animation plasma_wave3 = beacon_animation(
color=wave3_pattern, # color source
pos=20, # initial position
beacon_size=12, # smaller wave
color=wave3_pattern # color source
pos=20 # initial position
beacon_size=12 # smaller wave
slew_size=6 # smooth
)
plasma_wave3.priority = 12

View File

@ -8,20 +8,20 @@ set half_length = 30
# Left side red flashing
animation left_red = beacon_animation(
color=0xFF0000, # Bright red
pos=15, # center of left half
beacon_size=15, # half the strip
slew_size=2 # sharp edges
color=0xFF0000 # Bright red
pos=15 # center of left half
beacon_size=15 # half the strip
slew_size=2 # sharp edges
)
left_red.priority = 10
left_red.opacity = square(min_value=0, max_value=255, duration=400ms, duty_cycle=50) # 50% duty cycle
# Right side blue flashing (opposite phase)
animation right_blue = beacon_animation(
color=0x0000FF, # Bright blue
pos=45, # center of right half
beacon_size=15, # half the strip
slew_size=2 # sharp edges
color=0x0000FF # Bright blue
pos=45 # center of right half
beacon_size=15 # half the strip
slew_size=2 # sharp edges
)
right_blue.priority = 10
right_blue.opacity = square(min_value=255, max_value=0, duration=400ms, duty_cycle=50) # Opposite phase

View File

@ -5,7 +5,7 @@
# Create smooth rainbow cycle animation
color rainbow_cycle = color_cycle(
palette=[0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8000FF, 0xFF00FF], # rainbow colors
palette=[0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8000FF, 0xFF00FF] # rainbow colors
cycle_period=5s # cycle period
)
animation rainbow_animation = solid(color=rainbow_cycle)

View File

@ -9,10 +9,10 @@ animation background = solid(color=scanner_bg)
# Main scanner pulse that bounces
animation scanner = beacon_animation(
color=0xFF0000, # Bright red
pos=2, # initial position
beacon_size=3, # pulse width
slew_size=2 # fade region
color=0xFF0000 # Bright red
pos=2 # initial position
beacon_size=3 # pulse width
slew_size=2 # fade region
)
scanner.priority = 10
@ -21,10 +21,10 @@ scanner.pos = triangle(min_value=2, max_value=57, duration=2s)
# Add trailing glow effect
animation scanner_trail = beacon_animation(
color=0x660000, # Dim red trail
pos=2, # initial position
beacon_size=6, # wider trail
slew_size=4 # more fade
color=0x660000 # Dim red trail
pos=2 # initial position
beacon_size=6 # wider trail
slew_size=4 # more fade
)
scanner_trail.priority = 5
set pos_test = triangle(min_value=2, max_value=57, duration=2s)

View File

@ -21,10 +21,10 @@ animation daylight_cycle = rich_palette_animation(palette=daylight_colors, cycle
# Add sun position effect - bright spot that moves
animation sun_position = beacon_animation(
color=0xFFFFAA, # Bright yellow sun
pos=5, # initial position
beacon_size=8, # sun size
slew_size=4 # soft glow
color=0xFFFFAA # Bright yellow sun
pos=5 # initial position
beacon_size=8 # sun size
slew_size=4 # soft glow
)
sun_position.priority = 10
sun_position.pos = smooth(min_value=5, max_value=55, duration=30s) # Sun arc across sky
@ -32,10 +32,10 @@ sun_position.opacity = smooth(min_value=0, max_value=255, duration=30s) # Fade
# Add atmospheric glow around sun
animation sun_glow = beacon_animation(
color=0xFFCC88, # Warm glow
pos=5, # initial position
beacon_size=16, # larger glow
slew_size=8 # very soft
color=0xFFCC88 # Warm glow
pos=5 # initial position
beacon_size=16 # larger glow
slew_size=8 # very soft
)
sun_glow.priority = 5
sun_glow.pos = smooth(min_value=5, max_value=55, duration=30s) # Follow sun
@ -43,8 +43,8 @@ sun_glow.opacity = smooth(min_value=0, max_value=150, duration=30s) # Dimmer gl
# Add twinkling stars during night phases
animation stars = twinkle_animation(
color=0xFFFFFF, # White stars
density=6, # density (star count)
color=0xFFFFFF # White stars
density=6 # density (star count)
twinkle_speed=1s # twinkle speed (slow twinkle)
)
stars.priority = 15

View File

@ -9,16 +9,16 @@ animation background = solid(color=night_sky)
# White twinkling stars
animation stars = twinkle_animation(
color=0xFFFFFF, # White stars
density=8, # density (number of stars)
color=0xFFFFFF # White stars
density=8 # density (number of stars)
twinkle_speed=500ms # twinkle speed (twinkle duration)
)
stars.priority = 10
# Add occasional bright flash
animation bright_flash = twinkle_animation(
color=0xFFFFAA, # Bright yellow-white
density=2, # density (fewer bright flashes)
color=0xFFFFAA # Bright yellow-white
density=2 # density (fewer bright flashes)
twinkle_speed=300ms # twinkle speed (quick flash)
)
bright_flash.priority = 15

View File

@ -237,24 +237,34 @@ color pulsing_blue = pulsating_color(
## Palette Definitions
Palettes define color gradients using position-color pairs and support two encoding formats:
Palettes define color gradients using position-color pairs and support two encoding formats with flexible syntax:
### Value-Based Palettes (Recommended)
Standard palettes use value positions from 0-255:
```dsl
# Traditional syntax with commas
palette fire_colors = [
(0, 0x000000), # Position 0: Black
(128, 0xFF0000), # Position 128: Red
(255, 0xFFFF00) # Position 255: Yellow
]
# New syntax without commas (when entries are on separate lines)
palette ocean_palette = [
(0, navy), # Using named colors
(128, cyan),
(0, navy) # Using named colors
(128, cyan)
(255, green)
]
# Mixed syntax also works
palette matrix_greens = [
(0, 0x000000), (64, 0x003300) # Multiple entries on one line
(128, 0x006600) # Single entry on separate line
(192, 0x00AA00)
(255, 0x00FF00)
]
```
### Tick-Based Palettes (Advanced)
@ -424,22 +434,56 @@ run sequence_name # Run a sequence
## Function Calls
Functions use named parameter syntax:
Functions use named parameter syntax with flexible formatting:
```dsl
# Single line (commas required)
function_name(param1=value1, param2=value2)
# Examples
# Multi-line (commas optional when parameters are on separate lines)
function_name(
param1=value1
param2=value2
param3=value3
)
# Mixed syntax (both commas and newlines work)
function_name(
param1=value1, param2=value2
param3=value3
)
```
**Examples:**
```dsl
# Traditional single-line syntax
solid(color=red)
pulsating_animation(color=blue, period=2s)
triangle(min_value=0, max_value=255, period=3s)
# New multi-line syntax (no commas needed)
pulsating_animation(
color=blue
period=2s
brightness=255
)
# Mixed syntax
comet_animation(
color=stream_pattern, tail_length=15
speed=1.5s
priority=10
)
```
**Nested Function Calls:**
```dsl
pulsating_animation(
color=solid(color=red),
period=smooth(min_value=1000, max_value=3000, period=10s)
color=solid(color=red)
period=smooth(
min_value=1000
max_value=3000
period=10s
)
)
```
@ -667,6 +711,46 @@ whitespace = " " | "\t" | "\r" | "\n" ;
newline = "\n" | "\r\n" ;
```
## Flexible Parameter Syntax
The DSL supports flexible parameter syntax that makes multi-line function calls more readable:
### Traditional Syntax (Commas Required)
```dsl
animation stream = comet_animation(color=red, tail_length=15, speed=1.5s, priority=10)
```
### New Multi-Line Syntax (Commas Optional)
```dsl
animation stream = comet_animation(
color=red
tail_length=15
speed=1.5s
priority=10
)
```
### Mixed Syntax (Both Supported)
```dsl
animation stream = comet_animation(
color=red, tail_length=15
speed=1.5s
priority=10
)
```
### Rules
- **Single line**: Commas are required between parameters
- **Multi-line**: Commas are optional when parameters are on separate lines
- **Mixed**: You can use both commas and newlines as separators
- **Comments**: Inline comments work with both syntaxes
This applies to:
- Animation function calls
- Color provider function calls
- Value provider function calls
- Palette entries
## Language Features Summary
### ✅ Currently Implemented
@ -682,6 +766,7 @@ newline = "\n" | "\r\n" ;
- Parameter validation at compile time
- Execution statements
- User-defined functions (with engine-first parameter pattern) - see **[User Functions Guide](USER_FUNCTIONS.md)**
- **Flexible parameter syntax**: Commas optional when parameters are on separate lines
### 🚧 Partially Implemented
- Expression evaluation (basic support)

View File

@ -169,7 +169,7 @@ def animation_init_strip(*l)
import animation
import introspect
# we keep a hash of strip configurations to reuse existing engines
if !introspect.contains(animation, "_engines")
if !introspect.contains(animation, "_strips")
animation._engines = {}
end
@ -182,7 +182,6 @@ def animation_init_strip(*l)
else
var strip = call(global.Leds, l) # call global.Leds() with vararg
engine = animation.create_engine(strip)
animation._engines[l_as_string] = engine
end
return engine

View File

@ -218,7 +218,7 @@ class SimpleDSLTranspiler
var palette_entries = []
while !self.at_end() && !self.check_right_bracket()
self.skip_whitespace()
self.skip_whitespace_including_newlines()
if self.check_right_bracket()
break
@ -235,11 +235,24 @@ class SimpleDSLTranspiler
var vrgb_entry = self.convert_to_vrgb(value, color)
palette_entries.push(f'"{vrgb_entry}"')
self.skip_whitespace()
# Skip whitespace but preserve newlines for separator detection
while !self.at_end()
var tok = self.current()
if tok != nil && tok.type == animation_dsl.Token.COMMENT
self.next()
else
break
end
end
# Check for entry separator: comma OR newline OR end of palette
if self.current() != nil && self.current().type == animation_dsl.Token.COMMA
self.next() # skip comma
self.skip_whitespace()
self.skip_whitespace_including_newlines()
elif self.current() != nil && self.current().type == animation_dsl.Token.NEWLINE
# Newline acts as entry separator - skip it and continue
self.next() # skip newline
self.skip_whitespace_including_newlines()
elif !self.check_right_bracket()
self.error("Expected ',' or ']' in palette definition")
break
@ -730,6 +743,18 @@ class SimpleDSLTranspiler
end
end
# Skip whitespace including newlines (for parameter parsing contexts)
def skip_whitespace_including_newlines()
while !self.at_end()
var tok = self.current()
if tok != nil && (tok.type == animation_dsl.Token.COMMENT || tok.type == animation_dsl.Token.NEWLINE)
self.next()
else
break
end
end
end
# Collect inline comment if present and return it formatted for Berry code
def collect_inline_comment()
var tok = self.current()
@ -877,7 +902,7 @@ class SimpleDSLTranspiler
end
while !self.at_end() && !self.check_right_paren()
self.skip_whitespace()
self.skip_whitespace_including_newlines()
if self.check_right_paren()
break
@ -898,11 +923,24 @@ class SimpleDSLTranspiler
# Generate parameter assignment immediately
self.add(f"{var_name}.{param_name} = {param_value}{inline_comment}")
self.skip_whitespace()
# Skip whitespace but preserve newlines for separator detection
while !self.at_end()
var tok = self.current()
if tok != nil && tok.type == animation_dsl.Token.COMMENT
self.next()
else
break
end
end
# Check for parameter separator: comma OR newline OR end of parameters
if self.current() != nil && self.current().type == animation_dsl.Token.COMMA
self.next() # skip comma
self.skip_whitespace()
self.skip_whitespace_including_newlines()
elif self.current() != nil && self.current().type == animation_dsl.Token.NEWLINE
# Newline acts as parameter separator - skip it and continue
self.next() # skip newline
self.skip_whitespace_including_newlines()
elif !self.check_right_paren()
self.error("Expected ',' or ')' in function arguments")
break
@ -1355,13 +1393,15 @@ class SimpleDSLTranspiler
# @param var_name: string - Variable name to assign parameters to
# @param func_name: string - Animation function name for validation
def _process_named_arguments_for_animation(var_name, func_name)
# Debug: print that we're entering this method
# print(f"DEBUG: Entering _process_named_arguments_for_animation for {func_name}")
self.expect_left_paren()
# Create animation instance once for parameter validation
var animation_instance = self._create_animation_instance_for_validation(func_name)
while !self.at_end() && !self.check_right_paren()
self.skip_whitespace()
self.skip_whitespace_including_newlines()
if self.check_right_paren()
break
@ -1382,11 +1422,24 @@ class SimpleDSLTranspiler
# Generate parameter assignment immediately
self.add(f"{var_name}.{param_name} = {param_value}{inline_comment}")
self.skip_whitespace()
# Skip whitespace but preserve newlines for separator detection
while !self.at_end()
var tok = self.current()
if tok != nil && tok.type == animation_dsl.Token.COMMENT
self.next()
else
break
end
end
# Check for parameter separator: comma OR newline OR end of parameters
if self.current() != nil && self.current().type == animation_dsl.Token.COMMA
self.next() # skip comma
self.skip_whitespace()
self.skip_whitespace_including_newlines()
elif self.current() != nil && self.current().type == animation_dsl.Token.NEWLINE
# Newline acts as parameter separator - skip it and continue
self.next() # skip newline
self.skip_whitespace_including_newlines()
elif !self.check_right_paren()
self.error("Expected ',' or ')' in function arguments")
break
@ -1501,7 +1554,7 @@ class SimpleDSLTranspiler
var instance = self._create_instance_for_validation(func_name)
while !self.at_end() && !self.check_right_paren()
self.skip_whitespace()
self.skip_whitespace_including_newlines()
if self.check_right_paren()
break
@ -1522,11 +1575,24 @@ class SimpleDSLTranspiler
# Generate parameter assignment immediately
self.add(f"{var_name}.{param_name} = {param_value}{inline_comment}")
self.skip_whitespace()
# Skip whitespace but preserve newlines for separator detection
while !self.at_end()
var tok = self.current()
if tok != nil && tok.type == animation_dsl.Token.COMMENT
self.next()
else
break
end
end
# Check for parameter separator: comma OR newline OR end of parameters
if self.current() != nil && self.current().type == animation_dsl.Token.COMMA
self.next() # skip comma
self.skip_whitespace()
self.skip_whitespace_including_newlines()
elif self.current() != nil && self.current().type == animation_dsl.Token.NEWLINE
# Newline acts as parameter separator - skip it and continue
self.next() # skip newline
self.skip_whitespace_including_newlines()
elif !self.check_right_paren()
self.error("Expected ',' or ')' in function arguments")
break

View File

@ -1152,21 +1152,22 @@ be_local_closure(animation_init_strip, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
( &(const bvalue[10]) { /* constants */
( &(const bvalue[11]) { /* constants */
/* K0 */ be_nested_str_weak(global),
/* K1 */ be_nested_str_weak(animation),
/* K2 */ be_nested_str_weak(introspect),
/* K3 */ be_nested_str_weak(contains),
/* K4 */ be_nested_str_weak(_engines),
/* K5 */ be_nested_str_weak(find),
/* K6 */ be_nested_str_weak(stop),
/* K7 */ be_nested_str_weak(clear),
/* K8 */ be_nested_str_weak(Leds),
/* K9 */ be_nested_str_weak(create_engine),
/* K4 */ be_nested_str_weak(_strips),
/* K5 */ be_nested_str_weak(_engines),
/* K6 */ be_nested_str_weak(find),
/* K7 */ be_nested_str_weak(stop),
/* K8 */ be_nested_str_weak(clear),
/* K9 */ be_nested_str_weak(Leds),
/* K10 */ be_nested_str_weak(create_engine),
}),
be_str_weak(animation_init_strip),
&be_const_str_solidified,
( &(const binstruction[37]) { /* code */
( &(const binstruction[35]) { /* code */
0xA4060000, // 0000 IMPORT R1 K0
0xA40A0200, // 0001 IMPORT R2 K1
0xA40E0400, // 0002 IMPORT R3 K2
@ -1177,33 +1178,31 @@ be_local_closure(animation_init_strip, /* name */
0x74120002, // 0007 JMPT R4 #000B
0x60100013, // 0008 GETGBL R4 G19
0x7C100000, // 0009 CALL R4 0
0x900A0804, // 000A SETMBR R2 K4 R4
0x900A0A04, // 000A SETMBR R2 K5 R4
0x60100008, // 000B GETGBL R4 G8
0x5C140000, // 000C MOVE R5 R0
0x7C100200, // 000D CALL R4 1
0x88140504, // 000E GETMBR R5 R2 K4
0x8C140B05, // 000F GETMET R5 R5 K5
0x88140505, // 000E GETMBR R5 R2 K5
0x8C140B06, // 000F GETMET R5 R5 K6
0x5C1C0800, // 0010 MOVE R7 R4
0x7C140400, // 0011 CALL R5 2
0x4C180000, // 0012 LDNIL R6
0x20180A06, // 0013 NE R6 R5 R6
0x781A0004, // 0014 JMPF R6 #001A
0x8C180B06, // 0015 GETMET R6 R5 K6
0x8C180B07, // 0015 GETMET R6 R5 K7
0x7C180200, // 0016 CALL R6 1
0x8C180B07, // 0017 GETMET R6 R5 K7
0x8C180B08, // 0017 GETMET R6 R5 K8
0x7C180200, // 0018 CALL R6 1
0x70020009, // 0019 JMP #0024
0x70020007, // 0019 JMP #0022
0x60180016, // 001A GETGBL R6 G22
0x881C0308, // 001B GETMBR R7 R1 K8
0x881C0309, // 001B GETMBR R7 R1 K9
0x5C200000, // 001C MOVE R8 R0
0x7C180400, // 001D CALL R6 2
0x8C1C0509, // 001E GETMET R7 R2 K9
0x8C1C050A, // 001E GETMET R7 R2 K10
0x5C240C00, // 001F MOVE R9 R6
0x7C1C0400, // 0020 CALL R7 2
0x5C140E00, // 0021 MOVE R5 R7
0x881C0504, // 0022 GETMBR R7 R2 K4
0x981C0805, // 0023 SETIDX R7 R4 R5
0x80040A00, // 0024 RET 1 R5
0x80040A00, // 0022 RET 1 R5
})
)
);

View File

@ -0,0 +1,240 @@
# DSL Newline Syntax Test Suite
# Tests for the new flexible parameter syntax (commas optional on separate lines)
#
# Command to run test:
# ./berry -s -g -m lib/libesp32/berry_animation/src -e "import tasmota" lib/libesp32/berry_animation/src/tests/dsl_newline_syntax_test.be
import animation
import animation_dsl
import string
# Test animation parameters with newline syntax
def test_animation_newline_parameters()
print("Testing animation parameters with newlines...")
var dsl_source =
"color custom_red = 0xFF0000\n" +
"animation stream1 = comet_animation(\n" +
" color=custom_red\n" +
" tail_length=15\n" +
" speed=1.5s\n" +
" priority=10\n" +
")\n" +
"run stream1"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile DSL with newline parameters")
assert(string.find(berry_code, "var stream1_ = animation.comet_animation(engine)") >= 0, "Should generate animation creation")
assert(string.find(berry_code, "stream1_.color = animation.global('custom_red_'") >= 0, "Should generate color assignment")
assert(string.find(berry_code, "stream1_.tail_length = 15") >= 0, "Should generate tail_length assignment")
assert(string.find(berry_code, "stream1_.speed = 1500") >= 0, "Should generate speed assignment")
assert(string.find(berry_code, "stream1_.priority = 10") >= 0, "Should generate priority assignment")
print("✓ Animation newline parameters test passed")
return true
end
# Test palette entries with newline syntax
def test_palette_newline_entries()
print("Testing palette entries with newlines...")
var dsl_source =
"palette matrix_greens = [\n" +
" (0, 0x000000)\n" +
" (64, 0x003300)\n" +
" (128, 0x006600)\n" +
" (192, 0x00AA00)\n" +
" (255, 0x00FF00)\n" +
"]\n" +
"color stream_color = rich_palette(palette=matrix_greens, cycle_period=2s)\n" +
"animation stream = solid(color=stream_color)\n" +
"run stream"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile DSL with newline palette entries")
assert(string.find(berry_code, "var matrix_greens_ = bytes(") >= 0, "Should generate palette bytes")
print("✓ Palette newline entries test passed")
return true
end
# Test mixed comma and newline syntax
def test_mixed_syntax()
print("Testing mixed comma and newline syntax...")
var dsl_source =
"color custom_red = 0xFF0000\n" +
"animation mixed = comet_animation(\n" +
" color=custom_red, tail_length=15\n" +
" speed=1.5s\n" +
" priority=10, direction=1\n" +
")\n" +
"run mixed"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile DSL with mixed syntax")
assert(string.find(berry_code, "mixed_.color = animation.global('custom_red_'") >= 0, "Should generate color assignment")
assert(string.find(berry_code, "mixed_.tail_length = 15") >= 0, "Should generate tail_length assignment")
assert(string.find(berry_code, "mixed_.speed = 1500") >= 0, "Should generate speed assignment")
assert(string.find(berry_code, "mixed_.priority = 10") >= 0, "Should generate priority assignment")
assert(string.find(berry_code, "mixed_.direction = 1") >= 0, "Should generate direction assignment")
print("✓ Mixed syntax test passed")
return true
end
# Test that traditional comma syntax still works
def test_traditional_comma_syntax()
print("Testing traditional comma syntax still works...")
var dsl_source =
"color custom_red = 0xFF0000\n" +
"animation traditional = comet_animation(color=custom_red, tail_length=15, speed=1.5s, priority=10)\n" +
"run traditional"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile DSL with traditional comma syntax")
assert(string.find(berry_code, "traditional_.color = animation.global('custom_red_'") >= 0, "Should generate color assignment")
assert(string.find(berry_code, "traditional_.tail_length = 15") >= 0, "Should generate tail_length assignment")
print("✓ Traditional comma syntax test passed")
return true
end
# Test color provider with newline syntax
def test_color_provider_newline_syntax()
print("Testing color provider with newline syntax...")
var dsl_source =
"palette test_palette = [(0, 0x000000), (255, 0xFFFFFF)]\n" +
"color dynamic_color = rich_palette(\n" +
" palette=test_palette\n" +
" cycle_period=2s\n" +
" transition_type=LINEAR\n" +
" brightness=255\n" +
")\n" +
"animation test = solid(color=dynamic_color)\n" +
"run test"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile color provider with newline syntax")
assert(string.find(berry_code, "var dynamic_color_ = animation.rich_palette(engine)") >= 0, "Should generate color provider creation")
assert(string.find(berry_code, "dynamic_color_.palette = animation.global('test_palette_'") >= 0, "Should generate palette assignment")
assert(string.find(berry_code, "dynamic_color_.cycle_period = 2000") >= 0, "Should generate cycle_period assignment")
print("✓ Color provider newline syntax test passed")
return true
end
# Test nested function calls with newline syntax
def test_nested_function_calls()
print("Testing nested function calls with newline syntax...")
var dsl_source =
"animation nested = pulsating_animation(\n" +
" color=solid(color=red)\n" +
" period=triangle(\n" +
" min_value=1000\n" +
" max_value=3000\n" +
" duration=10s\n" +
" )\n" +
")\n" +
"run nested"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile nested function calls with newline syntax")
assert(string.find(berry_code, "var nested_ = animation.pulsating_animation(engine)") >= 0, "Should generate main animation")
assert(string.find(berry_code, "var temp_solid_") >= 0, "Should generate nested solid call")
assert(string.find(berry_code, "var temp_triangle_") >= 0, "Should generate nested triangle call")
print("✓ Nested function calls test passed")
return true
end
# Test complex real-world example
def test_complex_example()
print("Testing complex real-world example...")
var dsl_source =
"# Matrix rain effect with newline syntax\n" +
"palette matrix_greens = [\n" +
" (0, 0x000000) # Black\n" +
" (64, 0x003300) # Dark green\n" +
" (128, 0x006600) # Medium green\n" +
" (255, 0x00FF00) # Neon green\n" +
"]\n" +
"\n" +
"color stream_pattern = rich_palette(\n" +
" palette=matrix_greens\n" +
" cycle_period=2s\n" +
" transition_type=LINEAR\n" +
" brightness=255\n" +
")\n" +
"\n" +
"animation stream = comet_animation(\n" +
" color=stream_pattern # color source\n" +
" tail_length=15 # long tail\n" +
" speed=1.5s # speed\n" +
" priority=10\n" +
")\n" +
"\n" +
"run stream"
var berry_code = animation_dsl.compile(dsl_source)
assert(berry_code != nil, "Should compile complex real-world example")
assert(string.find(berry_code, "var matrix_greens_ = bytes(") >= 0, "Should generate palette")
assert(string.find(berry_code, "var stream_pattern_ = animation.rich_palette(engine)") >= 0, "Should generate color provider")
assert(string.find(berry_code, "var stream_ = animation.comet_animation(engine)") >= 0, "Should generate animation")
print("✓ Complex example test passed")
return true
end
# Run all tests
def run_all_tests()
print("=== DSL Newline Syntax Test Suite ===")
var tests = [
test_animation_newline_parameters,
test_palette_newline_entries,
test_mixed_syntax,
test_traditional_comma_syntax,
test_color_provider_newline_syntax,
test_nested_function_calls,
test_complex_example
]
var passed = 0
var total = size(tests)
for test : tests
try
if test()
passed += 1
end
except .. as e, msg
print(f"❌ Test failed with exception: {msg}")
end
print("")
end
print(f"=== Results: {passed}/{total} tests passed ===")
if passed == total
print("🎉 All newline syntax tests passed!")
return true
else
print("❌ Some tests failed")
raise "failed_test"
end
end
# Run the tests
run_all_tests()

View File

@ -231,12 +231,14 @@ def run_all_dsl_runtime_tests()
print("✓ Core runtime tests: PASSED")
else
print("✗ Core runtime tests: FAILED")
raise "failed_tests"
end
if file_tests_passed
print("✓ File operation tests: PASSED")
else
print("✓ File operation tests: SKIPPED (filesystem not available)")
raise "failed_tests"
end
return basic_tests_passed

View File

@ -110,6 +110,7 @@ def run_all_tests()
"lib/libesp32/berry_animation/src/tests/palette_dsl_test.be",
"lib/libesp32/berry_animation/src/tests/dsl_parameter_validation_test.be",
"lib/libesp32/berry_animation/src/tests/dsl_value_provider_validation_test.be",
"lib/libesp32/berry_animation/src/tests/dsl_newline_syntax_test.be",
# Event system tests
"lib/libesp32/berry_animation/src/tests/event_system_test.be"