Berry animation rename cycle_period to period (#24260)

This commit is contained in:
s-hadinger 2025-12-26 11:21:40 +01:00 committed by GitHub
parent f82cbeb2aa
commit 7a0c639bd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
113 changed files with 367 additions and 417 deletions

View File

@ -56,7 +56,7 @@ run pulse
### Rainbow Smooth Color Cycling ### Rainbow Smooth Color Cycling
```berry ```berry
animation rainbow = rich_palette_animation(palette=PALETTE_RAINBOW) animation rainbow = rich_palette_animation(colors=PALETTE_RAINBOW)
run rainbow run rainbow
``` ```

View File

@ -23,7 +23,7 @@ palette breathe_palette = [
# Create a rich palette color provider # Create a rich palette color provider
color palette_pattern = rich_palette( color palette_pattern = rich_palette(
colors=breathe_palette # palette colors=breathe_palette # palette
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness) period=15s # cycle period (defaults: smooth transition, 255 brightness)
) )
# Create breathing animation using the palette # Create breathing animation using the palette

View File

@ -17,7 +17,7 @@ palette ornament_colors = [
] ]
# Colorful ornaments as twinkling lights # Colorful ornaments as twinkling lights
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255) color ornament_pattern = rich_palette(colors=ornament_colors, period=3s, transition_type=LINEAR, brightness=255)
animation ornaments = twinkle_animation( animation ornaments = twinkle_animation(
color=ornament_pattern # color source color=ornament_pattern # color source
density=15 # density (many ornaments) density=15 # density (many ornaments)
@ -44,7 +44,7 @@ animation snow_sparkles = twinkle_animation(
snow_sparkles.priority = 15 snow_sparkles.priority = 15
# Garland effect - moving colored lights # Garland effect - moving colored lights
color garland_pattern = rich_palette(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200) color garland_pattern = rich_palette(colors=ornament_colors, period=2s, transition_type=LINEAR, brightness=200)
animation garland = comet_animation( animation garland = comet_animation(
color=garland_pattern # color source color=garland_pattern # color source
tail_length=6 # garland length (tail length) tail_length=6 # garland length (tail length)

View File

@ -30,7 +30,7 @@ var breathe_palette_ = bytes(
# Create a rich palette color provider # Create a rich palette color provider
var palette_pattern_ = animation.rich_palette(engine) var palette_pattern_ = animation.rich_palette(engine)
palette_pattern_.colors = breathe_palette_ # palette palette_pattern_.colors = breathe_palette_ # palette
palette_pattern_.cycle_period = 15000 # cycle period (defaults: smooth transition, 255 brightness) palette_pattern_.period = 15000 # cycle period (defaults: smooth transition, 255 brightness)
# Create breathing animation using the palette # Create breathing animation using the palette
var breathing_ = animation.breathe_animation(engine) var breathing_ = animation.breathe_animation(engine)
breathing_.color = palette_pattern_ # base animation breathing_.color = palette_pattern_ # base animation
@ -76,7 +76,7 @@ palette breathe_palette = [
# Create a rich palette color provider # Create a rich palette color provider
color palette_pattern = rich_palette( color palette_pattern = rich_palette(
colors=breathe_palette # palette colors=breathe_palette # palette
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness) period=15s # cycle period (defaults: smooth transition, 255 brightness)
) )
# Create breathing animation using the palette # Create breathing animation using the palette

View File

@ -27,7 +27,7 @@ var ornament_colors_ = bytes(
# Colorful ornaments as twinkling lights # Colorful ornaments as twinkling lights
var ornament_pattern_ = animation.rich_palette(engine) var ornament_pattern_ = animation.rich_palette(engine)
ornament_pattern_.colors = ornament_colors_ ornament_pattern_.colors = ornament_colors_
ornament_pattern_.cycle_period = 3000 ornament_pattern_.period = 3000
ornament_pattern_.transition_type = animation.LINEAR ornament_pattern_.transition_type = animation.LINEAR
ornament_pattern_.brightness = 255 ornament_pattern_.brightness = 255
var ornaments_ = animation.twinkle_animation(engine) var ornaments_ = animation.twinkle_animation(engine)
@ -58,7 +58,7 @@ snow_sparkles_.priority = 15
# Garland effect - moving colored lights # Garland effect - moving colored lights
var garland_pattern_ = animation.rich_palette(engine) var garland_pattern_ = animation.rich_palette(engine)
garland_pattern_.colors = ornament_colors_ garland_pattern_.colors = ornament_colors_
garland_pattern_.cycle_period = 2000 garland_pattern_.period = 2000
garland_pattern_.transition_type = animation.LINEAR garland_pattern_.transition_type = animation.LINEAR
garland_pattern_.brightness = 200 garland_pattern_.brightness = 200
var garland_ = animation.comet_animation(engine) var garland_ = animation.comet_animation(engine)
@ -95,7 +95,7 @@ palette ornament_colors = [
] ]
# Colorful ornaments as twinkling lights # Colorful ornaments as twinkling lights
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255) color ornament_pattern = rich_palette(colors=ornament_colors, period=3s, transition_type=LINEAR, brightness=255)
animation ornaments = twinkle_animation( animation ornaments = twinkle_animation(
color=ornament_pattern # color source color=ornament_pattern # color source
density=15 # density (many ornaments) density=15 # density (many ornaments)
@ -122,7 +122,7 @@ animation snow_sparkles = twinkle_animation(
snow_sparkles.priority = 15 snow_sparkles.priority = 15
# Garland effect - moving colored lights # Garland effect - moving colored lights
color garland_pattern = rich_palette(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200) color garland_pattern = rich_palette(colors=ornament_colors, period=2s, transition_type=LINEAR, brightness=200)
animation garland = comet_animation( animation garland = comet_animation(
color=garland_pattern # color source color=garland_pattern # color source
tail_length=6 # garland length (tail length) tail_length=6 # garland length (tail length)

View File

@ -16,7 +16,7 @@ var eye_duration_ = 5000 # duration for a cylon eye cycle
var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE") var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE")
var eye_color_ = animation.color_cycle(engine) var eye_color_ = animation.color_cycle(engine)
eye_color_.colors = eye_palette_ eye_color_.colors = eye_palette_
eye_color_.cycle_period = 0 eye_color_.period = 0
var cosine_val_ = (def (engine) var cosine_val_ = (def (engine)
var provider = animation.cosine_osc(engine) var provider = animation.cosine_osc(engine)
provider.min_value = 0 provider.min_value = 0
@ -58,7 +58,7 @@ set eye_duration = 5s # duration for a cylon eye cycle
palette eye_palette = [ red, yellow, green, violet ] palette eye_palette = [ red, yellow, green, violet ]
color eye_color = color_cycle(colors=eye_palette, cycle_period=0) color eye_color = color_cycle(colors=eye_palette, period=0)
set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration) set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration) set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration)

View File

@ -23,10 +23,10 @@ var shutter_size_ = (def (engine)
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.PALETTE_RAINBOW col1_.colors = animation.PALETTE_RAINBOW
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.PALETTE_RAINBOW col2_.colors = animation.PALETTE_RAINBOW
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
var shutter_animation_ = animation.beacon_animation(engine) var shutter_animation_ = animation.beacon_animation(engine)
shutter_animation_.color = col1_ shutter_animation_.color = col1_
@ -57,8 +57,8 @@ set duration = 3s
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
color col1 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0) color col1 = color_cycle(colors=PALETTE_RAINBOW, period=0)
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0) color col2 = color_cycle(colors=PALETTE_RAINBOW, period=0)
col2.next = 1 col2.next = 1
animation shutter_animation = beacon_animation( animation shutter_animation = beacon_animation(

View File

@ -30,10 +30,10 @@ class shutter_bidir_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving from left to right # shutter moving from left to right
var shutter_lr_animation_ = animation.beacon_animation(engine) var shutter_lr_animation_ = animation.beacon_animation(engine)
@ -100,8 +100,8 @@ template animation shutter_bidir {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -31,10 +31,10 @@ class shutter_central_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving in to out # shutter moving in to out
var shutter_inout_animation_ = animation.beacon_animation(engine) var shutter_inout_animation_ = animation.beacon_animation(engine)
@ -101,8 +101,8 @@ template animation shutter_central {
set strip_len2 = (strip_len + 1) / 2 set strip_len2 = (strip_len + 1) / 2
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving in to out # shutter moving in to out

View File

@ -30,10 +30,10 @@ class shutter_lr_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving from left to right # shutter moving from left to right
var shutter_lr_animation_ = animation.beacon_animation(engine) var shutter_lr_animation_ = animation.beacon_animation(engine)
@ -83,8 +83,8 @@ template animation shutter_lr {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -25,7 +25,7 @@ var disco_colors_ = bytes(
# Fast color cycling base # Fast color cycling base
var disco_rich_color_ = animation.rich_palette(engine) var disco_rich_color_ = animation.rich_palette(engine)
disco_rich_color_.colors = disco_colors_ disco_rich_color_.colors = disco_colors_
disco_rich_color_.cycle_period = 1000 disco_rich_color_.period = 1000
disco_rich_color_.transition_type = animation.LINEAR disco_rich_color_.transition_type = animation.LINEAR
disco_rich_color_.brightness = 255 disco_rich_color_.brightness = 255
var disco_base_ = animation.solid(engine) var disco_base_ = animation.solid(engine)
@ -54,7 +54,7 @@ white_flash_.priority = 20
# Add colored sparkles # Add colored sparkles
var sparkle_pattern_ = animation.rich_palette(engine) var sparkle_pattern_ = animation.rich_palette(engine)
sparkle_pattern_.colors = disco_colors_ sparkle_pattern_.colors = disco_colors_
sparkle_pattern_.cycle_period = 500 sparkle_pattern_.period = 500
sparkle_pattern_.transition_type = animation.LINEAR sparkle_pattern_.transition_type = animation.LINEAR
sparkle_pattern_.brightness = 255 sparkle_pattern_.brightness = 255
var disco_sparkles_ = animation.twinkle_animation(engine) var disco_sparkles_ = animation.twinkle_animation(engine)
@ -65,7 +65,7 @@ disco_sparkles_.priority = 15
# Add moving pulse for extra effect # Add moving pulse for extra effect
var pulse_pattern_ = animation.rich_palette(engine) var pulse_pattern_ = animation.rich_palette(engine)
pulse_pattern_.colors = disco_colors_ pulse_pattern_.colors = disco_colors_
pulse_pattern_.cycle_period = 800 pulse_pattern_.period = 800
pulse_pattern_.transition_type = animation.LINEAR pulse_pattern_.transition_type = animation.LINEAR
pulse_pattern_.brightness = 255 pulse_pattern_.brightness = 255
var disco_pulse_ = animation.beacon_animation(engine) var disco_pulse_ = animation.beacon_animation(engine)
@ -107,7 +107,7 @@ palette disco_colors = [
] ]
# Fast color cycling base # Fast color cycling base
color disco_rich_color = rich_palette(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255) color disco_rich_color = rich_palette(colors=disco_colors, period=1s, transition_type=LINEAR, brightness=255)
animation disco_base = solid(color=disco_rich_color) animation disco_base = solid(color=disco_rich_color)
# Add strobe effect # Add strobe effect
@ -119,7 +119,7 @@ white_flash.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cyc
white_flash.priority = 20 white_flash.priority = 20
# Add colored sparkles # Add colored sparkles
color sparkle_pattern = rich_palette(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255) color sparkle_pattern = rich_palette(colors=disco_colors, period=500ms, transition_type=LINEAR, brightness=255)
animation disco_sparkles = twinkle_animation( animation disco_sparkles = twinkle_animation(
color=sparkle_pattern # color source color=sparkle_pattern # color source
density=12 # density (many sparkles) density=12 # density (many sparkles)
@ -128,7 +128,7 @@ animation disco_sparkles = twinkle_animation(
disco_sparkles.priority = 15 disco_sparkles.priority = 15
# Add moving pulse for extra effect # Add moving pulse for extra effect
color pulse_pattern = rich_palette(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255) color pulse_pattern = rich_palette(colors=disco_colors, period=800ms, transition_type=LINEAR, brightness=255)
animation disco_pulse = beacon_animation( animation disco_pulse = beacon_animation(
color=pulse_pattern # color source color=pulse_pattern # color source
pos=4 # initial position pos=4 # initial position

View File

@ -23,7 +23,7 @@ var fire_colors_ = bytes(
# Create base fire animation with palette # Create base fire animation with palette
var fire_base_color_ = animation.rich_palette(engine) var fire_base_color_ = animation.rich_palette(engine)
fire_base_color_.colors = fire_colors_ fire_base_color_.colors = fire_colors_
fire_base_color_.cycle_period = 3000 fire_base_color_.period = 3000
fire_base_color_.transition_type = animation.LINEAR fire_base_color_.transition_type = animation.LINEAR
fire_base_color_.brightness = 255 fire_base_color_.brightness = 255
var fire_base_ = animation.solid(engine) var fire_base_ = animation.solid(engine)
@ -39,7 +39,7 @@ end)(engine)
# Add subtle position variation for more realism # Add subtle position variation for more realism
var flicker_pattern_ = animation.rich_palette(engine) var flicker_pattern_ = animation.rich_palette(engine)
flicker_pattern_.colors = fire_colors_ flicker_pattern_.colors = fire_colors_
flicker_pattern_.cycle_period = 2000 flicker_pattern_.period = 2000
flicker_pattern_.transition_type = animation.LINEAR flicker_pattern_.transition_type = animation.LINEAR
flicker_pattern_.brightness = 255 flicker_pattern_.brightness = 255
var fire_flicker_ = animation.twinkle_animation(engine) var fire_flicker_ = animation.twinkle_animation(engine)
@ -69,14 +69,14 @@ palette fire_colors = [
] ]
# Create base fire animation with palette # Create base fire animation with palette
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255) color fire_base_color = rich_palette(colors=fire_colors, period=3s, transition_type=LINEAR, brightness=255)
animation fire_base = solid(color=fire_base_color) animation fire_base = solid(color=fire_base_color)
# Add flickering effect with random intensity changes # Add flickering effect with random intensity changes
fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms) fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
# Add subtle position variation for more realism # Add subtle position variation for more realism
color flicker_pattern = rich_palette(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255) color flicker_pattern = rich_palette(colors=fire_colors, period=2s, transition_type=LINEAR, brightness=255)
animation fire_flicker = twinkle_animation( animation fire_flicker = twinkle_animation(
color=flicker_pattern # color source color=flicker_pattern # color source
density=12 # density (number of flickers) density=12 # density (number of flickers)

View File

@ -23,13 +23,13 @@ var lava_colors_ = bytes(
# Base lava animation - very slow color changes # Base lava animation - very slow color changes
var lava_base_ = animation.rich_palette_animation(engine) var lava_base_ = animation.rich_palette_animation(engine)
lava_base_.colors = lava_colors_ lava_base_.colors = lava_colors_
lava_base_.cycle_period = 15000 lava_base_.period = 15000
lava_base_.transition_type = animation.SINE lava_base_.transition_type = animation.SINE
lava_base_.brightness = 180 lava_base_.brightness = 180
# Add slow-moving lava blobs # Add slow-moving lava blobs
var blob1_pattern_ = animation.rich_palette(engine) var blob1_pattern_ = animation.rich_palette(engine)
blob1_pattern_.colors = lava_colors_ blob1_pattern_.colors = lava_colors_
blob1_pattern_.cycle_period = 12000 blob1_pattern_.period = 12000
blob1_pattern_.transition_type = animation.SINE blob1_pattern_.transition_type = animation.SINE
blob1_pattern_.brightness = 255 blob1_pattern_.brightness = 255
var lava_blob1_ = animation.beacon_animation(engine) var lava_blob1_ = animation.beacon_animation(engine)
@ -47,7 +47,7 @@ lava_blob1_.pos = (def (engine)
end)(engine) # Very slow movement end)(engine) # Very slow movement
var blob2_pattern_ = animation.rich_palette(engine) var blob2_pattern_ = animation.rich_palette(engine)
blob2_pattern_.colors = lava_colors_ blob2_pattern_.colors = lava_colors_
blob2_pattern_.cycle_period = 10000 blob2_pattern_.period = 10000
blob2_pattern_.transition_type = animation.SINE blob2_pattern_.transition_type = animation.SINE
blob2_pattern_.brightness = 220 blob2_pattern_.brightness = 220
var lava_blob2_ = animation.beacon_animation(engine) var lava_blob2_ = animation.beacon_animation(engine)
@ -65,7 +65,7 @@ lava_blob2_.pos = (def (engine)
end)(engine) # Opposite direction, slower end)(engine) # Opposite direction, slower
var blob3_pattern_ = animation.rich_palette(engine) var blob3_pattern_ = animation.rich_palette(engine)
blob3_pattern_.colors = lava_colors_ blob3_pattern_.colors = lava_colors_
blob3_pattern_.cycle_period = 8000 blob3_pattern_.period = 8000
blob3_pattern_.transition_type = animation.SINE blob3_pattern_.transition_type = animation.SINE
blob3_pattern_.brightness = 200 blob3_pattern_.brightness = 200
var lava_blob3_ = animation.beacon_animation(engine) var lava_blob3_ = animation.beacon_animation(engine)
@ -84,7 +84,7 @@ end)(engine) # Small movement range
# Add subtle heat shimmer effect # Add subtle heat shimmer effect
var shimmer_pattern_ = animation.rich_palette(engine) var shimmer_pattern_ = animation.rich_palette(engine)
shimmer_pattern_.colors = lava_colors_ shimmer_pattern_.colors = lava_colors_
shimmer_pattern_.cycle_period = 6000 shimmer_pattern_.period = 6000
shimmer_pattern_.transition_type = animation.SINE shimmer_pattern_.transition_type = animation.SINE
shimmer_pattern_.brightness = 255 shimmer_pattern_.brightness = 255
var heat_shimmer_ = animation.twinkle_animation(engine) var heat_shimmer_ = animation.twinkle_animation(engine)
@ -117,10 +117,10 @@ palette lava_colors = [
] ]
# Base lava animation - very slow color changes # Base lava animation - very slow color changes
animation lava_base = rich_palette_animation(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180) animation lava_base = rich_palette_animation(colors=lava_colors, period=15s, transition_type=SINE, brightness=180)
# Add slow-moving lava blobs # Add slow-moving lava blobs
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255) color blob1_pattern = rich_palette(colors=lava_colors, period=12s, transition_type=SINE, brightness=255)
animation lava_blob1 = beacon_animation( animation lava_blob1 = beacon_animation(
color=blob1_pattern # color source color=blob1_pattern # color source
pos=9 # initial position pos=9 # initial position
@ -130,7 +130,7 @@ animation lava_blob1 = beacon_animation(
lava_blob1.priority = 10 lava_blob1.priority = 10
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
color blob2_pattern = rich_palette(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220) color blob2_pattern = rich_palette(colors=lava_colors, period=10s, transition_type=SINE, brightness=220)
animation lava_blob2 = beacon_animation( animation lava_blob2 = beacon_animation(
color=blob2_pattern # color source color=blob2_pattern # color source
pos=46 # initial position pos=46 # initial position
@ -140,7 +140,7 @@ animation lava_blob2 = beacon_animation(
lava_blob2.priority = 8 lava_blob2.priority = 8
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
color blob3_pattern = rich_palette(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200) color blob3_pattern = rich_palette(colors=lava_colors, period=8s, transition_type=SINE, brightness=200)
animation lava_blob3 = beacon_animation( animation lava_blob3 = beacon_animation(
color=blob3_pattern # color source color=blob3_pattern # color source
pos=25 # initial position pos=25 # initial position
@ -151,7 +151,7 @@ lava_blob3.priority = 6
lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range
# Add subtle heat shimmer effect # Add subtle heat shimmer effect
color shimmer_pattern = rich_palette(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255) color shimmer_pattern = rich_palette(colors=lava_colors, period=6s, transition_type=SINE, brightness=255)
animation heat_shimmer = twinkle_animation( animation heat_shimmer = twinkle_animation(
color=shimmer_pattern # color source color=shimmer_pattern # color source
density=6 # density (shimmer points) density=6 # density (shimmer points)

View File

@ -20,7 +20,7 @@ var storm_colors_ = bytes(
) )
var storm_bg_ = animation.rich_palette_animation(engine) var storm_bg_ = animation.rich_palette_animation(engine)
storm_bg_.colors = storm_colors_ storm_bg_.colors = storm_colors_
storm_bg_.cycle_period = 12000 storm_bg_.period = 12000
storm_bg_.transition_type = animation.SINE storm_bg_.transition_type = animation.SINE
storm_bg_.brightness = 100 storm_bg_.brightness = 100
# Random lightning flashes - full strip # Random lightning flashes - full strip
@ -92,7 +92,7 @@ palette storm_colors = [
(255, 0x220033) # Slightly lighter purple (255, 0x220033) # Slightly lighter purple
] ]
animation storm_bg = rich_palette_animation(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100) animation storm_bg = rich_palette_animation(colors=storm_colors, period=12s, transition_type=SINE, brightness=100)
# Random lightning flashes - full strip # Random lightning flashes - full strip
animation lightning_main = solid(color=0xFFFFFF) # Bright white animation lightning_main = solid(color=0xFFFFFF) # Bright white

View File

@ -28,7 +28,7 @@ var matrix_greens_ = bytes(
# Create multiple cascading streams # Create multiple cascading streams
var stream1_pattern_ = animation.rich_palette(engine) var stream1_pattern_ = animation.rich_palette(engine)
stream1_pattern_.colors = matrix_greens_ stream1_pattern_.colors = matrix_greens_
stream1_pattern_.cycle_period = 2000 stream1_pattern_.period = 2000
stream1_pattern_.transition_type = animation.LINEAR stream1_pattern_.transition_type = animation.LINEAR
stream1_pattern_.brightness = 255 stream1_pattern_.brightness = 255
var stream1_ = animation.comet_animation(engine) var stream1_ = animation.comet_animation(engine)
@ -38,7 +38,7 @@ stream1_.speed = 1500 # speed
stream1_.priority = 10 stream1_.priority = 10
var stream2_pattern_ = animation.rich_palette(engine) var stream2_pattern_ = animation.rich_palette(engine)
stream2_pattern_.colors = matrix_greens_ stream2_pattern_.colors = matrix_greens_
stream2_pattern_.cycle_period = 1800 stream2_pattern_.period = 1800
stream2_pattern_.transition_type = animation.LINEAR stream2_pattern_.transition_type = animation.LINEAR
stream2_pattern_.brightness = 200 stream2_pattern_.brightness = 200
var stream2_ = animation.comet_animation(engine) var stream2_ = animation.comet_animation(engine)
@ -48,7 +48,7 @@ stream2_.speed = 2200 # different speed
stream2_.priority = 8 stream2_.priority = 8
var stream3_pattern_ = animation.rich_palette(engine) var stream3_pattern_ = animation.rich_palette(engine)
stream3_pattern_.colors = matrix_greens_ stream3_pattern_.colors = matrix_greens_
stream3_pattern_.cycle_period = 2500 stream3_pattern_.period = 2500
stream3_pattern_.transition_type = animation.LINEAR stream3_pattern_.transition_type = animation.LINEAR
stream3_pattern_.brightness = 180 stream3_pattern_.brightness = 180
var stream3_ = animation.comet_animation(engine) var stream3_ = animation.comet_animation(engine)
@ -91,7 +91,7 @@ palette matrix_greens = [
] ]
# Create multiple cascading streams # Create multiple cascading streams
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255) color stream1_pattern = rich_palette(colors=matrix_greens, period=2s, transition_type=LINEAR, brightness=255)
animation stream1 = comet_animation( animation stream1 = comet_animation(
color=stream1_pattern # color source color=stream1_pattern # color source
tail_length=15 # long tail tail_length=15 # long tail
@ -100,7 +100,7 @@ animation stream1 = comet_animation(
) )
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200) color stream2_pattern = rich_palette(colors=matrix_greens, period=1.8s, transition_type=LINEAR, brightness=200)
animation stream2 = comet_animation( animation stream2 = comet_animation(
color=stream2_pattern # color source color=stream2_pattern # color source
tail_length=12 # medium tail tail_length=12 # medium tail
@ -108,7 +108,7 @@ animation stream2 = comet_animation(
priority = 8 priority = 8
) )
color stream3_pattern = rich_palette(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180) color stream3_pattern = rich_palette(colors=matrix_greens, period=2.5s, transition_type=LINEAR, brightness=180)
animation stream3 = comet_animation( animation stream3 = comet_animation(
color=stream3_pattern # color source color=stream3_pattern # color source
tail_length=10 # shorter tail tail_length=10 # shorter tail

View File

@ -22,7 +22,7 @@ var neon_colors_ = bytes(
# Main neon glow with color cycling # Main neon glow with color cycling
var neon_main_ = animation.rich_palette_animation(engine) var neon_main_ = animation.rich_palette_animation(engine)
neon_main_.colors = neon_colors_ neon_main_.colors = neon_colors_
neon_main_.cycle_period = 4000 neon_main_.period = 4000
neon_main_.transition_type = animation.LINEAR neon_main_.transition_type = animation.LINEAR
neon_main_.brightness = 255 neon_main_.brightness = 255
# Add electrical flickering # Add electrical flickering
@ -49,7 +49,7 @@ neon_surge_.priority = 20
# Add neon tube segments with gaps # Add neon tube segments with gaps
var segment_pattern_ = animation.rich_palette(engine) var segment_pattern_ = animation.rich_palette(engine)
segment_pattern_.colors = neon_colors_ segment_pattern_.colors = neon_colors_
segment_pattern_.cycle_period = 4000 segment_pattern_.period = 4000
segment_pattern_.transition_type = animation.LINEAR segment_pattern_.transition_type = animation.LINEAR
segment_pattern_.brightness = 255 segment_pattern_.brightness = 255
var segment1_ = animation.beacon_animation(engine) var segment1_ = animation.beacon_animation(engine)
@ -101,7 +101,7 @@ palette neon_colors = [
] ]
# Main neon glow with color cycling # Main neon glow with color cycling
animation neon_main = rich_palette_animation(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255) animation neon_main = rich_palette_animation(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
# Add electrical flickering # Add electrical flickering
neon_main.opacity = smooth(min_value=220, max_value=255, duration=200ms) neon_main.opacity = smooth(min_value=220, max_value=255, duration=200ms)
@ -112,7 +112,7 @@ neon_surge.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cycl
neon_surge.priority = 20 neon_surge.priority = 20
# Add neon tube segments with gaps # Add neon tube segments with gaps
color segment_pattern = rich_palette(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255) color segment_pattern = rich_palette(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
animation segment1 = beacon_animation( animation segment1 = beacon_animation(
color=segment_pattern # color source color=segment_pattern # color source
pos=6 # position pos=6 # position

View File

@ -23,13 +23,13 @@ var ocean_colors_ = bytes(
# Base ocean animation with slow color cycling # Base ocean animation with slow color cycling
var ocean_base_ = animation.rich_palette_animation(engine) var ocean_base_ = animation.rich_palette_animation(engine)
ocean_base_.colors = ocean_colors_ ocean_base_.colors = ocean_colors_
ocean_base_.cycle_period = 8000 ocean_base_.period = 8000
ocean_base_.transition_type = animation.SINE ocean_base_.transition_type = animation.SINE
ocean_base_.brightness = 200 ocean_base_.brightness = 200
# Add wave motion with moving pulses # Add wave motion with moving pulses
var wave1_pattern_ = animation.rich_palette(engine) var wave1_pattern_ = animation.rich_palette(engine)
wave1_pattern_.colors = ocean_colors_ wave1_pattern_.colors = ocean_colors_
wave1_pattern_.cycle_period = 6000 wave1_pattern_.period = 6000
wave1_pattern_.transition_type = animation.SINE wave1_pattern_.transition_type = animation.SINE
wave1_pattern_.brightness = 255 wave1_pattern_.brightness = 255
var wave1_ = animation.beacon_animation(engine) var wave1_ = animation.beacon_animation(engine)
@ -47,7 +47,7 @@ wave1_.pos = (def (engine)
end)(engine) # 60-12 = 48 end)(engine) # 60-12 = 48
var wave2_pattern_ = animation.rich_palette(engine) var wave2_pattern_ = animation.rich_palette(engine)
wave2_pattern_.colors = ocean_colors_ wave2_pattern_.colors = ocean_colors_
wave2_pattern_.cycle_period = 4000 wave2_pattern_.period = 4000
wave2_pattern_.transition_type = animation.SINE wave2_pattern_.transition_type = animation.SINE
wave2_pattern_.brightness = 180 wave2_pattern_.brightness = 180
var wave2_ = animation.beacon_animation(engine) var wave2_ = animation.beacon_animation(engine)
@ -93,10 +93,10 @@ palette ocean_colors = [
] ]
# Base ocean animation with slow color cycling # Base ocean animation with slow color cycling
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200) animation ocean_base = rich_palette_animation(colors=ocean_colors, period=8s, transition_type=SINE, brightness=200)
# Add wave motion with moving pulses # Add wave motion with moving pulses
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255) color wave1_pattern = rich_palette(colors=ocean_colors, period=6s, transition_type=SINE, brightness=255)
animation wave1 = beacon_animation( animation wave1 = beacon_animation(
color=wave1_pattern # color source color=wave1_pattern # color source
pos=0 # initial position pos=0 # initial position
@ -106,7 +106,7 @@ animation wave1 = beacon_animation(
wave1.priority = 10 wave1.priority = 10
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48 wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
color wave2_pattern = rich_palette(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180) color wave2_pattern = rich_palette(colors=ocean_colors, period=4s, transition_type=SINE, brightness=180)
animation wave2 = beacon_animation( animation wave2 = beacon_animation(
color=wave2_pattern # color source color=wave2_pattern # color source
pos=52 # initial position pos=52 # initial position

View File

@ -25,10 +25,10 @@ var ocean_colors_ = bytes(
# Create animations using the palettes # Create animations using the palettes
var fire_anim_ = animation.rich_palette_animation(engine) var fire_anim_ = animation.rich_palette_animation(engine)
fire_anim_.colors = fire_colors_ fire_anim_.colors = fire_colors_
fire_anim_.cycle_period = 5000 fire_anim_.period = 5000
var ocean_anim_ = animation.rich_palette_animation(engine) var ocean_anim_ = animation.rich_palette_animation(engine)
ocean_anim_.colors = ocean_colors_ ocean_anim_.colors = ocean_colors_
ocean_anim_.cycle_period = 8000 ocean_anim_.period = 8000
# Sequence to show both palettes # Sequence to show both palettes
var palette_demo_ = animation.sequence_manager(engine) var palette_demo_ = animation.sequence_manager(engine)
.push_play_step(fire_anim_, 10000) .push_play_step(fire_anim_, 10000)
@ -62,9 +62,9 @@ palette ocean_colors = [
] ]
# Create animations using the palettes # Create animations using the palettes
animation fire_anim = rich_palette_animation(colors=fire_colors, cycle_period=5s) animation fire_anim = rich_palette_animation(colors=fire_colors, period=5s)
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s) animation ocean_anim = rich_palette_animation(colors=ocean_colors, period=8s)
# Sequence to show both palettes # Sequence to show both palettes
sequence palette_demo { sequence palette_demo {

View File

@ -53,22 +53,22 @@ var fire_effect_ = animation.solid(engine)
fire_effect_.color = (def (engine) fire_effect_.color = (def (engine)
var provider = animation.rich_palette(engine) var provider = animation.rich_palette(engine)
provider.colors = fire_gradient_ provider.colors = fire_gradient_
provider.cycle_period = 3000 provider.period = 3000
return provider return provider
end)(engine) end)(engine)
var ocean_waves_ = animation.rich_palette_animation(engine) var ocean_waves_ = animation.rich_palette_animation(engine)
ocean_waves_.colors = ocean_depths_ ocean_waves_.colors = ocean_depths_
ocean_waves_.cycle_period = 8000 ocean_waves_.period = 8000
ocean_waves_.transition_type = animation.SINE ocean_waves_.transition_type = animation.SINE
ocean_waves_.brightness = 200 ocean_waves_.brightness = 200
var aurora_lights_ = animation.rich_palette_animation(engine) var aurora_lights_ = animation.rich_palette_animation(engine)
aurora_lights_.colors = aurora_borealis_ aurora_lights_.colors = aurora_borealis_
aurora_lights_.cycle_period = 12000 aurora_lights_.period = 12000
aurora_lights_.transition_type = animation.SINE aurora_lights_.transition_type = animation.SINE
aurora_lights_.brightness = 180 aurora_lights_.brightness = 180
var sunset_glow_ = animation.rich_palette_animation(engine) var sunset_glow_ = animation.rich_palette_animation(engine)
sunset_glow_.colors = sunset_sky_ sunset_glow_.colors = sunset_sky_
sunset_glow_.cycle_period = 6000 sunset_glow_.period = 6000
sunset_glow_.transition_type = animation.SINE sunset_glow_.transition_type = animation.SINE
sunset_glow_.brightness = 220 sunset_glow_.brightness = 220
# Sequence to showcase all palettes # Sequence to showcase all palettes
@ -143,13 +143,13 @@ palette sunset_sky = [
] ]
# Create animations using each palette # Create animations using each palette
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s)) animation fire_effect = solid(color=rich_palette(colors=fire_gradient, period=3s))
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200) animation ocean_waves = rich_palette_animation(colors=ocean_depths, period=8s, transition_type=SINE, brightness=200)
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180) animation aurora_lights = rich_palette_animation(colors=aurora_borealis, period=12s, transition_type=SINE, brightness=180)
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220) animation sunset_glow = rich_palette_animation(colors=sunset_sky, period=6s, transition_type=SINE, brightness=220)
# Sequence to showcase all palettes # Sequence to showcase all palettes
sequence palette_showcase { sequence palette_showcase {

View File

@ -24,13 +24,13 @@ var plasma_colors_ = bytes(
# Base plasma animation with medium speed # Base plasma animation with medium speed
var plasma_base_ = animation.rich_palette_animation(engine) var plasma_base_ = animation.rich_palette_animation(engine)
plasma_base_.colors = plasma_colors_ plasma_base_.colors = plasma_colors_
plasma_base_.cycle_period = 6000 plasma_base_.period = 6000
plasma_base_.transition_type = animation.SINE plasma_base_.transition_type = animation.SINE
plasma_base_.brightness = 200 plasma_base_.brightness = 200
# Add multiple wave layers for complexity # Add multiple wave layers for complexity
var wave1_pattern_ = animation.rich_palette(engine) var wave1_pattern_ = animation.rich_palette(engine)
wave1_pattern_.colors = plasma_colors_ wave1_pattern_.colors = plasma_colors_
wave1_pattern_.cycle_period = 4000 wave1_pattern_.period = 4000
wave1_pattern_.transition_type = animation.SINE wave1_pattern_.transition_type = animation.SINE
wave1_pattern_.brightness = 255 wave1_pattern_.brightness = 255
var plasma_wave1_ = animation.beacon_animation(engine) var plasma_wave1_ = animation.beacon_animation(engine)
@ -48,7 +48,7 @@ plasma_wave1_.pos = (def (engine)
end)(engine) end)(engine)
var wave2_pattern_ = animation.rich_palette(engine) var wave2_pattern_ = animation.rich_palette(engine)
wave2_pattern_.colors = plasma_colors_ wave2_pattern_.colors = plasma_colors_
wave2_pattern_.cycle_period = 5000 wave2_pattern_.period = 5000
wave2_pattern_.transition_type = animation.SINE wave2_pattern_.transition_type = animation.SINE
wave2_pattern_.brightness = 180 wave2_pattern_.brightness = 180
var plasma_wave2_ = animation.beacon_animation(engine) var plasma_wave2_ = animation.beacon_animation(engine)
@ -66,7 +66,7 @@ plasma_wave2_.pos = (def (engine)
end)(engine) # Opposite direction end)(engine) # Opposite direction
var wave3_pattern_ = animation.rich_palette(engine) var wave3_pattern_ = animation.rich_palette(engine)
wave3_pattern_.colors = plasma_colors_ wave3_pattern_.colors = plasma_colors_
wave3_pattern_.cycle_period = 3000 wave3_pattern_.period = 3000
wave3_pattern_.transition_type = animation.SINE wave3_pattern_.transition_type = animation.SINE
wave3_pattern_.brightness = 220 wave3_pattern_.brightness = 220
var plasma_wave3_ = animation.beacon_animation(engine) var plasma_wave3_ = animation.beacon_animation(engine)
@ -115,10 +115,10 @@ palette plasma_colors = [
] ]
# Base plasma animation with medium speed # Base plasma animation with medium speed
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200) animation plasma_base = rich_palette_animation(colors=plasma_colors, period=6s, transition_type=SINE, brightness=200)
# Add multiple wave layers for complexity # Add multiple wave layers for complexity
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255) color wave1_pattern = rich_palette(colors=plasma_colors, period=4s, transition_type=SINE, brightness=255)
animation plasma_wave1 = beacon_animation( animation plasma_wave1 = beacon_animation(
color=wave1_pattern # color source color=wave1_pattern # color source
pos=0 # initial position pos=0 # initial position
@ -128,7 +128,7 @@ animation plasma_wave1 = beacon_animation(
plasma_wave1.priority = 10 plasma_wave1.priority = 10
plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s) plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s)
color wave2_pattern = rich_palette(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180) color wave2_pattern = rich_palette(colors=plasma_colors, period=5s, transition_type=SINE, brightness=180)
animation plasma_wave2 = beacon_animation( animation plasma_wave2 = beacon_animation(
color=wave2_pattern # color source color=wave2_pattern # color source
pos=45 # initial position pos=45 # initial position
@ -138,7 +138,7 @@ animation plasma_wave2 = beacon_animation(
plasma_wave2.priority = 8 plasma_wave2.priority = 8
plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction
color wave3_pattern = rich_palette(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220) color wave3_pattern = rich_palette(colors=plasma_colors, period=3s, transition_type=SINE, brightness=220)
animation plasma_wave3 = beacon_animation( animation plasma_wave3 = beacon_animation(
color=wave3_pattern # color source color=wave3_pattern # color source
pos=20 # initial position pos=20 # initial position

View File

@ -16,7 +16,7 @@ var rainbow_palette_ = bytes("FFFF0000" "FFFF8000" "FFFFFF00" "FF00FF00" "FF0000
# Create smooth rainbow cycle animation # Create smooth rainbow cycle animation
var rainbow_cycle_ = animation.color_cycle(engine) var rainbow_cycle_ = animation.color_cycle(engine)
rainbow_cycle_.colors = rainbow_palette_ rainbow_cycle_.colors = rainbow_palette_
rainbow_cycle_.cycle_period = 5000 # cycle period rainbow_cycle_.period = 5000 # cycle period
var rainbow_animation_ = animation.solid(engine) var rainbow_animation_ = animation.solid(engine)
rainbow_animation_.color = rainbow_cycle_ rainbow_animation_.color = rainbow_cycle_
# Start the animation # Start the animation
@ -35,7 +35,7 @@ palette rainbow_palette = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8
# Create smooth rainbow cycle animation # Create smooth rainbow cycle animation
color rainbow_cycle = color_cycle( color rainbow_cycle = color_cycle(
colors=rainbow_palette colors=rainbow_palette
cycle_period=5s # cycle period period=5s # cycle period
) )
animation rainbow_animation = solid(color=rainbow_cycle) animation rainbow_animation = solid(color=rainbow_cycle)

View File

@ -33,7 +33,7 @@ var brightness_low_ = 64
var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE") var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE")
var eye_color_ = animation.color_cycle(engine) var eye_color_ = animation.color_cycle(engine)
eye_color_.colors = eye_palette_ eye_color_.colors = eye_palette_
eye_color_.cycle_period = 0 eye_color_.period = 0
# Create animations # Create animations
var red_eye_ = animation.beacon_animation(engine) var red_eye_ = animation.beacon_animation(engine)
red_eye_.color = eye_color_ red_eye_.color = eye_color_
@ -126,7 +126,7 @@ set brightness_low = 64
# Create color palette and cycling color # Create color palette and cycling color
palette eye_palette = [red, yellow, green, violet] palette eye_palette = [red, yellow, green, violet]
color eye_color = color_cycle(colors=eye_palette, cycle_period=0) color eye_color = color_cycle(colors=eye_palette, period=0)
# Create animations # Create animations
animation red_eye = beacon_animation( animation red_eye = beacon_animation(

View File

@ -17,7 +17,7 @@ var rainbow_ = bytes("00FF0000" "40FFA500" "80FFFF00" "C0008000" "FF0000FF")
# Create an animation using the palette # Create an animation using the palette
var rainbow_cycle_ = animation.rich_palette_animation(engine) var rainbow_cycle_ = animation.rich_palette_animation(engine)
rainbow_cycle_.colors = rainbow_ rainbow_cycle_.colors = rainbow_
rainbow_cycle_.cycle_period = 3000 rainbow_cycle_.period = 3000
# Simple sequence # Simple sequence
var demo_ = animation.sequence_manager(engine) var demo_ = animation.sequence_manager(engine)
.push_play_step(rainbow_cycle_, 15000) .push_play_step(rainbow_cycle_, 15000)
@ -41,7 +41,7 @@ palette rainbow = [
] ]
# Create an animation using the palette # Create an animation using the palette
animation rainbow_cycle = rich_palette_animation(colors=rainbow, cycle_period=3s) animation rainbow_cycle = rich_palette_animation(colors=rainbow, period=3s)
# Simple sequence # Simple sequence
sequence demo { sequence demo {

View File

@ -27,7 +27,7 @@ var daylight_colors_ = bytes(
# Main daylight cycle - very slow transition # Main daylight cycle - very slow transition
var daylight_cycle_ = animation.rich_palette_animation(engine) var daylight_cycle_ = animation.rich_palette_animation(engine)
daylight_cycle_.colors = daylight_colors_ daylight_cycle_.colors = daylight_colors_
daylight_cycle_.cycle_period = 60000 daylight_cycle_.period = 60000
# Add sun position effect - bright spot that moves # Add sun position effect - bright spot that moves
var sun_position_ = animation.beacon_animation(engine) var sun_position_ = animation.beacon_animation(engine)
sun_position_.color = 0xFFFFFFAA # Bright yellow sun sun_position_.color = 0xFFFFFFAA # Bright yellow sun
@ -111,7 +111,7 @@ palette daylight_colors = [
] ]
# Main daylight cycle - very slow transition # Main daylight cycle - very slow transition
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, cycle_period=60s) animation daylight_cycle = rich_palette_animation(colors=daylight_colors, period=60s)
# Add sun position effect - bright spot that moves # Add sun position effect - bright spot that moves
animation sun_position = beacon_animation( animation sun_position = beacon_animation(

View File

@ -14,7 +14,7 @@ var strip_len_ = animation.strip_length(engine)
var palette_olivary_ = bytes("FFFF0000" "FFFFA500" "FFFFFF00" "FF008000" "FF0000FF" "FF4B0082" "FFEE82EE" "FFFFFFFF") var palette_olivary_ = bytes("FFFF0000" "FFFFA500" "FFFFFF00" "FF008000" "FF0000FF" "FF4B0082" "FFEE82EE" "FFFFFFFF")
var olivary_ = animation.color_cycle(engine) var olivary_ = animation.color_cycle(engine)
olivary_.colors = palette_olivary_ olivary_.colors = palette_olivary_
olivary_.cycle_period = 0 olivary_.period = 0
var swipe_animation_ = animation.solid(engine) var swipe_animation_ = animation.solid(engine)
swipe_animation_.color = olivary_ swipe_animation_.color = olivary_
var slide_colors_ = animation.sequence_manager(engine) var slide_colors_ = animation.sequence_manager(engine)
@ -40,7 +40,7 @@ palette palette_olivary = [
white white
] ]
color olivary = color_cycle(colors=palette_olivary, cycle_period=0) color olivary = color_cycle(colors=palette_olivary, period=0)
animation swipe_animation = solid( animation swipe_animation = solid(
color = olivary color = olivary

View File

@ -22,7 +22,7 @@ class rainbow_pulse_animation : animation.engine_proxy
var cycle_color_ = animation.color_cycle(engine) var cycle_color_ = animation.color_cycle(engine)
cycle_color_.colors = animation.create_closure_value(engine, def (engine) return self.pal1 end) cycle_color_.colors = animation.create_closure_value(engine, def (engine) return self.pal1 end)
cycle_color_.cycle_period = animation.create_closure_value(engine, def (engine) return self.period end) cycle_color_.period = animation.create_closure_value(engine, def (engine) return self.period end)
# Create pulsing animation # Create pulsing animation
var pulse_ = animation.pulsating_animation(engine) var pulse_ = animation.pulsating_animation(engine)
pulse_.color = cycle_color_ pulse_.color = cycle_color_
@ -68,7 +68,7 @@ template animation rainbow_pulse {
param back_color type color param back_color type color
# Create color cycle using first palette # Create color cycle using first palette
color cycle_color = color_cycle(colors=pal1, cycle_period=period) color cycle_color = color_cycle(colors=pal1, period=period)
# Create pulsing animation # Create pulsing animation
animation pulse = pulsating_animation( animation pulse = pulsating_animation(

View File

@ -30,10 +30,10 @@ class shutter_bidir_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving from left to right # shutter moving from left to right
var shutter_lr_animation_ = animation.beacon_animation(engine) var shutter_lr_animation_ = animation.beacon_animation(engine)
@ -101,8 +101,8 @@ template animation shutter_bidir {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -30,10 +30,10 @@ class shutter_central_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving from left to right # shutter moving from left to right
var shutter_central_animation_ = animation.beacon_animation(engine) var shutter_central_animation_ = animation.beacon_animation(engine)
@ -83,8 +83,8 @@ template animation shutter_central {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -30,10 +30,10 @@ class shutter_central_animation : animation.engine_proxy
end)(engine) end)(engine)
var col1_ = animation.color_cycle(engine) var col1_ = animation.color_cycle(engine)
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col1_.cycle_period = 0 col1_.period = 0
var col2_ = animation.color_cycle(engine) var col2_ = animation.color_cycle(engine)
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end) col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col2_.cycle_period = 0 col2_.period = 0
col2_.next = 1 col2_.next = 1
# shutter moving in to out # shutter moving in to out
var shutter_inout_animation_ = animation.beacon_animation(engine) var shutter_inout_animation_ = animation.beacon_animation(engine)
@ -91,8 +91,8 @@ template animation shutter_central {
set strip_len2 = (strip_len + 1) / 2 set strip_len2 = (strip_len + 1) / 2
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving in to out # shutter moving in to out

View File

@ -7,7 +7,7 @@ set eye_duration = 5s # duration for a cylon eye cycle
palette eye_palette = [ red, yellow, green, violet ] palette eye_palette = [ red, yellow, green, violet ]
color eye_color = color_cycle(colors=eye_palette, cycle_period=0) color eye_color = color_cycle(colors=eye_palette, period=0)
set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration) set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration) set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration)

View File

@ -7,8 +7,8 @@ set duration = 3s
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
color col1 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0) color col1 = color_cycle(colors=PALETTE_RAINBOW, period=0)
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0) color col2 = color_cycle(colors=PALETTE_RAINBOW, period=0)
col2.next = 1 col2.next = 1
animation shutter_animation = beacon_animation( animation shutter_animation = beacon_animation(

View File

@ -9,8 +9,8 @@ template animation shutter_bidir {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -10,8 +10,8 @@ template animation shutter_central {
set strip_len2 = (strip_len + 1) / 2 set strip_len2 = (strip_len + 1) / 2
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving in to out # shutter moving in to out

View File

@ -9,8 +9,8 @@ template animation shutter_lr {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -15,7 +15,7 @@ palette disco_colors = [
] ]
# Fast color cycling base # Fast color cycling base
color disco_rich_color = rich_palette(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255) color disco_rich_color = rich_palette(colors=disco_colors, period=1s, transition_type=LINEAR, brightness=255)
animation disco_base = solid(color=disco_rich_color) animation disco_base = solid(color=disco_rich_color)
# Add strobe effect # Add strobe effect
@ -27,7 +27,7 @@ white_flash.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cyc
white_flash.priority = 20 white_flash.priority = 20
# Add colored sparkles # Add colored sparkles
color sparkle_pattern = rich_palette(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255) color sparkle_pattern = rich_palette(colors=disco_colors, period=500ms, transition_type=LINEAR, brightness=255)
animation disco_sparkles = twinkle_animation( animation disco_sparkles = twinkle_animation(
color=sparkle_pattern # color source color=sparkle_pattern # color source
density=12 # density (many sparkles) density=12 # density (many sparkles)
@ -36,7 +36,7 @@ animation disco_sparkles = twinkle_animation(
disco_sparkles.priority = 15 disco_sparkles.priority = 15
# Add moving pulse for extra effect # Add moving pulse for extra effect
color pulse_pattern = rich_palette(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255) color pulse_pattern = rich_palette(colors=disco_colors, period=800ms, transition_type=LINEAR, brightness=255)
animation disco_pulse = beacon_animation( animation disco_pulse = beacon_animation(
color=pulse_pattern # color source color=pulse_pattern # color source
pos=4 # initial position pos=4 # initial position

View File

@ -13,14 +13,14 @@ palette fire_colors = [
] ]
# Create base fire animation with palette # Create base fire animation with palette
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255) color fire_base_color = rich_palette(colors=fire_colors, period=3s, transition_type=LINEAR, brightness=255)
animation fire_base = solid(color=fire_base_color) animation fire_base = solid(color=fire_base_color)
# Add flickering effect with random intensity changes # Add flickering effect with random intensity changes
fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms) fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
# Add subtle position variation for more realism # Add subtle position variation for more realism
color flicker_pattern = rich_palette(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255) color flicker_pattern = rich_palette(colors=fire_colors, period=2s, transition_type=LINEAR, brightness=255)
animation fire_flicker = twinkle_animation( animation fire_flicker = twinkle_animation(
color=flicker_pattern # color source color=flicker_pattern # color source
density=12 # density (number of flickers) density=12 # density (number of flickers)

View File

@ -13,10 +13,10 @@ palette lava_colors = [
] ]
# Base lava animation - very slow color changes # Base lava animation - very slow color changes
animation lava_base = rich_palette_animation(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180) animation lava_base = rich_palette_animation(colors=lava_colors, period=15s, transition_type=SINE, brightness=180)
# Add slow-moving lava blobs # Add slow-moving lava blobs
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255) color blob1_pattern = rich_palette(colors=lava_colors, period=12s, transition_type=SINE, brightness=255)
animation lava_blob1 = beacon_animation( animation lava_blob1 = beacon_animation(
color=blob1_pattern # color source color=blob1_pattern # color source
pos=9 # initial position pos=9 # initial position
@ -26,7 +26,7 @@ animation lava_blob1 = beacon_animation(
lava_blob1.priority = 10 lava_blob1.priority = 10
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
color blob2_pattern = rich_palette(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220) color blob2_pattern = rich_palette(colors=lava_colors, period=10s, transition_type=SINE, brightness=220)
animation lava_blob2 = beacon_animation( animation lava_blob2 = beacon_animation(
color=blob2_pattern # color source color=blob2_pattern # color source
pos=46 # initial position pos=46 # initial position
@ -36,7 +36,7 @@ animation lava_blob2 = beacon_animation(
lava_blob2.priority = 8 lava_blob2.priority = 8
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
color blob3_pattern = rich_palette(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200) color blob3_pattern = rich_palette(colors=lava_colors, period=8s, transition_type=SINE, brightness=200)
animation lava_blob3 = beacon_animation( animation lava_blob3 = beacon_animation(
color=blob3_pattern # color source color=blob3_pattern # color source
pos=25 # initial position pos=25 # initial position
@ -47,7 +47,7 @@ lava_blob3.priority = 6
lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range
# Add subtle heat shimmer effect # Add subtle heat shimmer effect
color shimmer_pattern = rich_palette(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255) color shimmer_pattern = rich_palette(colors=lava_colors, period=6s, transition_type=SINE, brightness=255)
animation heat_shimmer = twinkle_animation( animation heat_shimmer = twinkle_animation(
color=shimmer_pattern # color source color=shimmer_pattern # color source
density=6 # density (shimmer points) density=6 # density (shimmer points)

View File

@ -10,7 +10,7 @@ palette storm_colors = [
(255, 0x220033) # Slightly lighter purple (255, 0x220033) # Slightly lighter purple
] ]
animation storm_bg = rich_palette_animation(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100) animation storm_bg = rich_palette_animation(colors=storm_colors, period=12s, transition_type=SINE, brightness=100)
# Random lightning flashes - full strip # Random lightning flashes - full strip
animation lightning_main = solid(color=0xFFFFFF) # Bright white animation lightning_main = solid(color=0xFFFFFF) # Bright white

View File

@ -17,7 +17,7 @@ palette matrix_greens = [
] ]
# Create multiple cascading streams # Create multiple cascading streams
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255) color stream1_pattern = rich_palette(colors=matrix_greens, period=2s, transition_type=LINEAR, brightness=255)
animation stream1 = comet_animation( animation stream1 = comet_animation(
color=stream1_pattern # color source color=stream1_pattern # color source
tail_length=15 # long tail tail_length=15 # long tail
@ -26,7 +26,7 @@ animation stream1 = comet_animation(
) )
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200) color stream2_pattern = rich_palette(colors=matrix_greens, period=1.8s, transition_type=LINEAR, brightness=200)
animation stream2 = comet_animation( animation stream2 = comet_animation(
color=stream2_pattern # color source color=stream2_pattern # color source
tail_length=12 # medium tail tail_length=12 # medium tail
@ -34,7 +34,7 @@ animation stream2 = comet_animation(
priority = 8 priority = 8
) )
color stream3_pattern = rich_palette(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180) color stream3_pattern = rich_palette(colors=matrix_greens, period=2.5s, transition_type=LINEAR, brightness=180)
animation stream3 = comet_animation( animation stream3 = comet_animation(
color=stream3_pattern # color source color=stream3_pattern # color source
tail_length=10 # shorter tail tail_length=10 # shorter tail

View File

@ -12,7 +12,7 @@ palette neon_colors = [
] ]
# Main neon glow with color cycling # Main neon glow with color cycling
animation neon_main = rich_palette_animation(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255) animation neon_main = rich_palette_animation(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
# Add electrical flickering # Add electrical flickering
neon_main.opacity = smooth(min_value=220, max_value=255, duration=200ms) neon_main.opacity = smooth(min_value=220, max_value=255, duration=200ms)
@ -23,7 +23,7 @@ neon_surge.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cycl
neon_surge.priority = 20 neon_surge.priority = 20
# Add neon tube segments with gaps # Add neon tube segments with gaps
color segment_pattern = rich_palette(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255) color segment_pattern = rich_palette(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
animation segment1 = beacon_animation( animation segment1 = beacon_animation(
color=segment_pattern # color source color=segment_pattern # color source
pos=6 # position pos=6 # position

View File

@ -13,10 +13,10 @@ palette ocean_colors = [
] ]
# Base ocean animation with slow color cycling # Base ocean animation with slow color cycling
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200) animation ocean_base = rich_palette_animation(colors=ocean_colors, period=8s, transition_type=SINE, brightness=200)
# Add wave motion with moving pulses # Add wave motion with moving pulses
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255) color wave1_pattern = rich_palette(colors=ocean_colors, period=6s, transition_type=SINE, brightness=255)
animation wave1 = beacon_animation( animation wave1 = beacon_animation(
color=wave1_pattern # color source color=wave1_pattern # color source
pos=0 # initial position pos=0 # initial position
@ -26,7 +26,7 @@ animation wave1 = beacon_animation(
wave1.priority = 10 wave1.priority = 10
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48 wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
color wave2_pattern = rich_palette(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180) color wave2_pattern = rich_palette(colors=ocean_colors, period=4s, transition_type=SINE, brightness=180)
animation wave2 = beacon_animation( animation wave2 = beacon_animation(
color=wave2_pattern # color source color=wave2_pattern # color source
pos=52 # initial position pos=52 # initial position

View File

@ -16,9 +16,9 @@ palette ocean_colors = [
] ]
# Create animations using the palettes # Create animations using the palettes
animation fire_anim = rich_palette_animation(colors=fire_colors, cycle_period=5s) animation fire_anim = rich_palette_animation(colors=fire_colors, period=5s)
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s) animation ocean_anim = rich_palette_animation(colors=ocean_colors, period=8s)
# Sequence to show both palettes # Sequence to show both palettes
sequence palette_demo { sequence palette_demo {

View File

@ -44,13 +44,13 @@ palette sunset_sky = [
] ]
# Create animations using each palette # Create animations using each palette
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s)) animation fire_effect = solid(color=rich_palette(colors=fire_gradient, period=3s))
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200) animation ocean_waves = rich_palette_animation(colors=ocean_depths, period=8s, transition_type=SINE, brightness=200)
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180) animation aurora_lights = rich_palette_animation(colors=aurora_borealis, period=12s, transition_type=SINE, brightness=180)
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220) animation sunset_glow = rich_palette_animation(colors=sunset_sky, period=6s, transition_type=SINE, brightness=220)
# Sequence to showcase all palettes # Sequence to showcase all palettes
sequence palette_showcase { sequence palette_showcase {

View File

@ -14,10 +14,10 @@ palette plasma_colors = [
] ]
# Base plasma animation with medium speed # Base plasma animation with medium speed
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200) animation plasma_base = rich_palette_animation(colors=plasma_colors, period=6s, transition_type=SINE, brightness=200)
# Add multiple wave layers for complexity # Add multiple wave layers for complexity
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255) color wave1_pattern = rich_palette(colors=plasma_colors, period=4s, transition_type=SINE, brightness=255)
animation plasma_wave1 = beacon_animation( animation plasma_wave1 = beacon_animation(
color=wave1_pattern # color source color=wave1_pattern # color source
pos=0 # initial position pos=0 # initial position
@ -27,7 +27,7 @@ animation plasma_wave1 = beacon_animation(
plasma_wave1.priority = 10 plasma_wave1.priority = 10
plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s) plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s)
color wave2_pattern = rich_palette(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180) color wave2_pattern = rich_palette(colors=plasma_colors, period=5s, transition_type=SINE, brightness=180)
animation plasma_wave2 = beacon_animation( animation plasma_wave2 = beacon_animation(
color=wave2_pattern # color source color=wave2_pattern # color source
pos=45 # initial position pos=45 # initial position
@ -37,7 +37,7 @@ animation plasma_wave2 = beacon_animation(
plasma_wave2.priority = 8 plasma_wave2.priority = 8
plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction
color wave3_pattern = rich_palette(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220) color wave3_pattern = rich_palette(colors=plasma_colors, period=3s, transition_type=SINE, brightness=220)
animation plasma_wave3 = beacon_animation( animation plasma_wave3 = beacon_animation(
color=wave3_pattern # color source color=wave3_pattern # color source
pos=20 # initial position pos=20 # initial position

View File

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

View File

@ -10,7 +10,7 @@ set brightness_low = 64
# Create color palette and cycling color # Create color palette and cycling color
palette eye_palette = [red, yellow, green, violet] palette eye_palette = [red, yellow, green, violet]
color eye_color = color_cycle(colors=eye_palette, cycle_period=0) color eye_color = color_cycle(colors=eye_palette, period=0)
# Create animations # Create animations
animation red_eye = beacon_animation( animation red_eye = beacon_animation(

View File

@ -13,7 +13,7 @@ palette rainbow = [
] ]
# Create an animation using the palette # Create an animation using the palette
animation rainbow_cycle = rich_palette_animation(colors=rainbow, cycle_period=3s) animation rainbow_cycle = rich_palette_animation(colors=rainbow, period=3s)
# Simple sequence # Simple sequence
sequence demo { sequence demo {

View File

@ -17,7 +17,7 @@ palette daylight_colors = [
] ]
# Main daylight cycle - very slow transition # Main daylight cycle - very slow transition
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, cycle_period=60s) animation daylight_cycle = rich_palette_animation(colors=daylight_colors, period=60s)
# Add sun position effect - bright spot that moves # Add sun position effect - bright spot that moves
animation sun_position = beacon_animation( animation sun_position = beacon_animation(

View File

@ -13,7 +13,7 @@ palette palette_olivary = [
white white
] ]
color olivary = color_cycle(colors=palette_olivary, cycle_period=0) color olivary = color_cycle(colors=palette_olivary, period=0)
animation swipe_animation = solid( animation swipe_animation = solid(
color = olivary color = olivary

View File

@ -7,7 +7,7 @@ template animation rainbow_pulse {
param back_color type color param back_color type color
# Create color cycle using first palette # Create color cycle using first palette
color cycle_color = color_cycle(colors=pal1, cycle_period=period) color cycle_color = color_cycle(colors=pal1, period=period)
# Create pulsing animation # Create pulsing animation
animation pulse = pulsating_animation( animation pulse = pulsating_animation(

View File

@ -9,8 +9,8 @@ template animation shutter_bidir {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -9,8 +9,8 @@ template animation shutter_central {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving from left to right # shutter moving from left to right

View File

@ -9,8 +9,8 @@ template animation shutter_central {
set strip_len2 = (strip_len + 1) / 2 set strip_len2 = (strip_len + 1) / 2
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 col2.next = 1
# shutter moving in to out # shutter moving in to out

View File

@ -3,6 +3,6 @@
# Define a color attribute that cycles over time, cycle is 5 seconds # Define a color attribute that cycles over time, cycle is 5 seconds
# PALETTE_RAINBOW defines 7 rainbow colors at roughly the same brightness # PALETTE_RAINBOW defines 7 rainbow colors at roughly the same brightness
# PALETTE_RAINBOW_W adds 8th color white # PALETTE_RAINBOW_W adds 8th color white
color rainbow_color = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=5s) color rainbow_color = color_cycle(colors=PALETTE_RAINBOW_W, period=5s)
animation back = solid(color=rainbow_color) animation back = solid(color=rainbow_color)
run back run back

View File

@ -14,7 +14,7 @@ palette rainbow_with_white = [
] ]
# Define a color attribute that cycles over time, cycle is 5 seconds # Define a color attribute that cycles over time, cycle is 5 seconds
color rainbow_color = color_cycle(colors=rainbow_with_white, cycle_period=5s) color rainbow_color = color_cycle(colors=rainbow_with_white, period=5s)
# Define a solid background with this dynamic color # Define a solid background with this dynamic color
animation back = solid(color=rainbow_color) animation back = solid(color=rainbow_color)

View File

@ -2,6 +2,6 @@
animation back = rich_palette_animation() animation back = rich_palette_animation()
# Equivalent to # Equivalent to
# animation back = rich_palette_animation(colors=PALETTE_PALETTE_RAINBOW, cycle_period=5s, # animation back = rich_palette_animation(colors=PALETTE_PALETTE_RAINBOW, period=5s,
# transition_type=SINE, brightness=100%) # transition_type=SINE, brightness=100%)
run back run back

View File

@ -15,7 +15,7 @@ palette rainbow_with_white = [
] ]
# Define a color attribute that cycles over time, cycle is 10 seconds # Define a color attribute that cycles over time, cycle is 10 seconds
color rainbow_color_rollover = rich_palette(cycle_period=10s) color rainbow_color_rollover = rich_palette(period=10s)
# Use the dynamic color in a simple 'solid' animation # Use the dynamic color in a simple 'solid' animation
animation back = solid(color=rainbow_color_rollover) animation back = solid(color=rainbow_color_rollover)

View File

@ -1,8 +1,8 @@
# @desc Rainbow pattern # @desc Rainbow pattern
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white) # Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
# 'cycle_period = 0' means that the colors don't change in time, only spatial change # 'period = 0' means that the colors don't change in time, only spatial change
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0) color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
# Define a gradient across the whole strip # Define a gradient across the whole strip
animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color) animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color)

View File

@ -2,8 +2,8 @@
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white) # Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
# 'cycle_period = 0' means that the colors don't change in time, only spatial change # 'period = 0' means that the colors don't change in time, only spatial change
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0) color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas # Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
set strip_len = strip_length() set strip_len = strip_length()

View File

@ -1,8 +1,8 @@
# @desc Rainbow gradient with oscillating spatial period between 100% and 50% # @desc Rainbow gradient with oscillating spatial period between 100% and 50%
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white) # Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
# 'cycle_period = 0' means that the colors don't change in time, only spatial change # 'period = 0' means that the colors don't change in time, only spatial change
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0) color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas # Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
set strip_len = strip_length() set strip_len = strip_length()

View File

@ -1,8 +1,8 @@
# @desc Rainbow gradient rotating along the strip over 5 seconds # @desc Rainbow gradient rotating along the strip over 5 seconds
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white) # Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
# 'cycle_period = 0' means that the colors don't change in time, only spatial change # 'period = 0' means that the colors don't change in time, only spatial change
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0) color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
# define a gradient across the whole strip # define a gradient across the whole strip
animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s) animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s)

View File

@ -13,7 +13,7 @@ palette vue_meter_palette = [
] ]
# Define a color palette pattern for 'vue_meter_palette' # Define a color palette pattern for 'vue_meter_palette'
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR) color rainbow_rich_color = rich_palette(colors=vue_meter_palette, period=0, transition_type=LINEAR)
# Define a sawtooth value from 0% to 100% # Define a sawtooth value from 0% to 100%
set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s) set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s)

View File

@ -24,7 +24,7 @@ palette vue_meter_palette = [
] ]
# Define a color palette pattern for 'vue_meter_palette' # Define a color palette pattern for 'vue_meter_palette'
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR) color rainbow_rich_color = rich_palette(colors=vue_meter_palette, period=0, transition_type=LINEAR)
# Define a vue-meter based on all elements above # Define a vue-meter based on all elements above
animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter()) animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter())

View File

@ -16,7 +16,7 @@ run stars
# We can combine a dynamic 'pos' value with a dynamic 'color' # We can combine a dynamic 'pos' value with a dynamic 'color'
animation back = beacon_animation( animation back = beacon_animation(
color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s) color = rich_palette(colors=PALETTE_RAINBOW_W2, period=5s)
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s) pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
beacon_size = 3 # small 3 pixels eye beacon_size = 3 # small 3 pixels eye
slew_size = 2 # with 2 pixel shading around slew_size = 2 # with 2 pixel shading around

View File

@ -12,8 +12,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
# Define 2 color providers cycling through palette rainbow with white # Define 2 color providers cycling through palette rainbow with white
# 'col2' is shifted by 1 color from 'col1' # 'col2' is shifted by 1 color from 'col1'
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
col2.next = 1 # Writing 1 to 'next' actually advances the color col2.next = 1 # Writing 1 to 'next' actually advances the color
# Using beacon_animation to move a shutter from left to right # Using beacon_animation to move a shutter from left to right

View File

@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
# Define 2 color providers cycling through palette rainbow with white # Define 2 color providers cycling through palette rainbow with white
# 'col2' is shifted by 1 color from 'col1' # 'col2' is shifted by 1 color from 'col1'
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
col2.next = 1 # Writing 1 to 'next' actually advances the color col2.next = 1 # Writing 1 to 'next' actually advances the color
# Using beacon_animation to move a shutter from in to out # Using beacon_animation to move a shutter from in to out

View File

@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
# Define 2 color providers cycling through palette rainbow with white # Define 2 color providers cycling through palette rainbow with white
# 'col2' is shifted by 1 color from 'col1' # 'col2' is shifted by 1 color from 'col1'
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0) color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
col2.next = 1 # Writing 1 to 'next' actually advances the color col2.next = 1 # Writing 1 to 'next' actually advances the color
# Using beacon_animation to move a shutter from in to out # Using beacon_animation to move a shutter from in to out

View File

@ -1,7 +1,7 @@
# @desc Crenel static with variable color # @desc Crenel static with variable color
# Define a color attribute that cycles over time, cycle is 5 seconds # Define a color attribute that cycles over time, cycle is 5 seconds
color rainbow_color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s) color rainbow_color = rich_palette(colors=PALETTE_RAINBOW_W2, period=5s)
# Define a simple crenel 2+2 # Define a simple crenel 2+2
animation back = crenel_animation( animation back = crenel_animation(

View File

@ -13,7 +13,7 @@ animation mask = crenel_animation(
) )
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white) # Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0) color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
# Define a gradient across the whole strip and use crenel as opacity mask # Define a gradient across the whole strip and use crenel as opacity mask
animation pattern = palette_gradient_animation( animation pattern = palette_gradient_animation(
color_source = rainbow_rich_color # use the rainow pattern color_source = rainbow_rich_color # use the rainow pattern

View File

@ -1,4 +1,4 @@
# @desc Template example fir Cylon-style scanning eye # @desc Template example for Cylon-style scanning eye
# Define a full template with parameters: eye_color, back_color, period, priority # Define a full template with parameters: eye_color, back_color, period, priority
template animation cylon_eye { template animation cylon_eye {

View File

@ -1,12 +1,12 @@
# @desc Rainbow colors cycling with custom palette # @desc Rainbow colors cycling with custom palette
# Define a full template with parameters: colors, cycle_period # Define a full template with parameters: colors, period
template animation color_cycle2 { template animation color_cycle2 {
param colors type palette param colors type palette
param cycle_period default 5s param period default 5s
# Define a color attribute that cycles over time, cycle is 5 seconds # Define a color attribute that cycles over time, cycle is 5 seconds
color rainbow_color = color_cycle(colors=colors, cycle_period=cycle_period) color rainbow_color = color_cycle(colors=colors, period=period)
# Define a solid background with this dynamic color # Define a solid background with this dynamic color
animation back = solid(color=rainbow_color) animation back = solid(color=rainbow_color)
@ -19,5 +19,5 @@ palette rgb = [
0x0080FF # Blue 0x0080FF # Blue
] ]
animation main = color_cycle2(colors = rgb, cycle_period = 2s) animation main = color_cycle2(colors = rgb, period = 2s)
run main run main

View File

@ -15,8 +15,8 @@ template animation shutter_bidir {
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
# Define two rotating palettes, shifted by one color # Define two rotating palettes, shifted by one color
color col1 = color_cycle(colors=colors, cycle_period=0) color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, cycle_period=0) color col2 = color_cycle(colors=colors, period=0)
col2.next = 1 # move 'col2' to the next color so it's shifte by one compared to 'col1' col2.next = 1 # move 'col2' to the next color so it's shifte by one compared to 'col1'
# Shutter moving in in-out # Shutter moving in in-out

View File

@ -175,7 +175,7 @@ template animation fade_effect {
# 'duration' is implicit - no need to declare # 'duration' is implicit - no need to declare
set oscillator = sawtooth(min_value=0, max_value=255, duration=duration) set oscillator = sawtooth(min_value=0, max_value=255, duration=duration)
color col = color_cycle(palette=colors, cycle_period=0) color col = color_cycle(colors=colors, period=0)
animation test = solid(color=col) animation test = solid(color=col)
test.opacity = oscillator # 'opacity' is also implicit test.opacity = oscillator # 'opacity' is also implicit
@ -386,35 +386,35 @@ Cycles through a palette of colors with brutal switching. Inherits from `ColorPr
| Parameter | Type | Default | Constraints | Description | | Parameter | Type | Default | Constraints | Description |
|-----------|------|---------|-------------|-------------| |-----------|------|---------|-------------|-------------|
| `palette` | bytes | default palette | - | Palette bytes in AARRGGBB format | | `colors` | bytes | default palette | - | Palette bytes in AARRGGBB format |
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = manual only) | | `period` | int | 5000 | min: 0 | Cycle time in ms (0 = manual only) |
| `next` | int | 0 | - | Write 1 to move to next color manually, or any number to go forward or backwards by `n` colors | | `next` | int | 0 | - | Write 1 to move to next color manually, or any number to go forward or backwards by `n` colors |
| `palette_size` | int | 3 | read-only | Number of colors in the palette (automatically updated when palette changes) | | `palette_size` | int | 3 | read-only | Number of colors in the palette (automatically updated when palette changes) |
| *(inherits brightness from ColorProvider)* | | | | | | *(inherits brightness from ColorProvider)* | | | | |
**Note**: The `get_color_for_value()` method accepts values in the 0-255 range for value-based color mapping. **Note**: The `get_color_for_value()` method accepts values in the 0-255 range for value-based color mapping.
**Modes**: Auto-cycle (`cycle_period > 0`) or Manual-only (`cycle_period = 0`) **Modes**: Auto-cycle (`period > 0`) or Manual-only (`period = 0`)
#### Usage Examples #### Usage Examples
```berry ```berry
# RGB cycle with brutal switching # RGB cycle with brutal switching
color rgb_cycle = color_cycle( color rgb_cycle = color_cycle(
palette=bytes("FF0000FF" "FF00FF00" "FFFF0000"), colors=bytes("FF0000FF" "FF00FF00" "FFFF0000"),
cycle_period=4s period=4s
) )
# Custom warm colors # Custom warm colors
color warm_cycle = color_cycle( color warm_cycle = color_cycle(
palette=bytes("FF4500FF" "FF8C00FF" "FFFF00"), colors=bytes("FF4500FF" "FF8C00FF" "FFFF00"),
cycle_period=3s period=3s
) )
# Mixed colors in AARRGGBB format # Mixed colors in AARRGGBB format
color mixed_cycle = color_cycle( color mixed_cycle = color_cycle(
palette=bytes("FFFF0000" "FF00FF00" "FF0000FF"), colors=bytes("FFFF0000" "FF00FF00" "FF0000FF"),
cycle_period=2s period=2s
) )
``` ```
@ -424,8 +424,8 @@ Generates colors from predefined palettes with smooth transitions and profession
| Parameter | Type | Default | Constraints | Description | | Parameter | Type | Default | Constraints | Description |
|-----------|------|---------|-------------|-------------| |-----------|------|---------|-------------|-------------|
| `palette` | bytes | rainbow palette | - | Palette bytes or predefined palette constant | | `colors` | bytes | rainbow palette | - | Palette bytes or predefined palette constant |
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) | | `period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
| `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out | | `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out |
| *(inherits brightness from ColorProvider)* | | | | | | *(inherits brightness from ColorProvider)* | | | | |
@ -442,16 +442,16 @@ Generates colors from predefined palettes with smooth transitions and profession
```berry ```berry
# Rainbow palette with smooth ease-in/ease-out transitions # Rainbow palette with smooth ease-in/ease-out transitions
color rainbow_colors = rich_palette( color rainbow_colors = rich_palette(
palette=PALETTE_RAINBOW, colors=PALETTE_RAINBOW,
cycle_period=5s, period=5s,
transition_type=SINE, transition_type=SINE,
brightness=255 brightness=255
) )
# Fire effect with linear (constant speed) transitions # Fire effect with linear (constant speed) transitions
color fire_colors = rich_palette( color fire_colors = rich_palette(
palette=PALETTE_FIRE, colors=PALETTE_FIRE,
cycle_period=3s, period=3s,
transition_type=LINEAR, transition_type=LINEAR,
brightness=200 brightness=200
) )
@ -509,7 +509,7 @@ color deep_breath = breathe_color(
) )
# Using dynamic base color # Using dynamic base color
color rainbow_cycle = color_cycle(palette=bytes("FF0000FF" "FF00FF00" "FFFF0000"), cycle_period=5s) color rainbow_cycle = color_cycle(colors=bytes("FF0000FF" "FF00FF00" "FFFF0000"), period=5s)
color breathing_rainbow = breathe_color( color breathing_rainbow = breathe_color(
base_color=rainbow_cycle, base_color=rainbow_cycle,
min_brightness=30, min_brightness=30,
@ -634,7 +634,7 @@ meter.color_source = rainbow
meter.level = 128 meter.level = 128
# Meter with peak hold (1 second) # Meter with peak hold (1 second)
color fire_colors = rich_palette(palette=PALETTE_FIRE) color fire_colors = rich_palette(colors=PALETTE_FIRE)
animation vu_meter = gradient_meter_animation(peak_hold=1000) animation vu_meter = gradient_meter_animation(peak_hold=1000)
vu_meter.color_source = fire_colors vu_meter.color_source = fire_colors
@ -962,14 +962,14 @@ Creates smooth color transitions using rich palette data with direct parameter a
| Parameter | Type | Default | Constraints | Description | | Parameter | Type | Default | Constraints | Description |
|-----------|------|---------|-------------|-------------| |-----------|------|---------|-------------|-------------|
| `palette` | bytes | rainbow palette | - | Palette bytes or predefined palette | | `colors` | bytes | rainbow palette | - | Palette bytes or predefined palette |
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) | | `period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
| `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out | | `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out |
| `brightness` | int | 255 | 0-255 | Overall brightness scaling | | `brightness` | int | 255 | 0-255 | Overall brightness scaling |
| *(inherits all Animation parameters)* | | | | | | *(inherits all Animation parameters)* | | | | |
**Special Features**: **Special Features**:
- Direct parameter access (set `anim.palette` instead of `anim.color.palette`) - Direct parameter access (set `anim.colors` instead of `anim.color.colors`)
- Parameters are automatically forwarded to internal `RichPaletteColorProvider` - Parameters are automatically forwarded to internal `RichPaletteColorProvider`
- Access to specialized methods via `anim.color_provider.method_name()` - Access to specialized methods via `anim.color_provider.method_name()`

View File

@ -233,7 +233,7 @@ class MyColorProvider : animation.color_provider
# Mark LUT as dirty when parameters change # Mark LUT as dirty when parameters change
def on_param_changed(name, value) def on_param_changed(name, value)
super(self).on_param_changed(name, value) super(self).on_param_changed(name, value)
if name == "palette" || name == "transition_type" if name == "colors" || name == "transition_type"
self._lut_dirty = true # Inherited from ColorProvider self._lut_dirty = true # Inherited from ColorProvider
end end
end end

View File

@ -373,8 +373,8 @@ color my_white = white # Reference to predefined color
# Color providers for dynamic colors # Color providers for dynamic colors
color rainbow_cycle = color_cycle( color rainbow_cycle = color_cycle(
palette=bytes("FFFF0000" "FF00FF00" "FF0000FF") colors=bytes("FFFF0000" "FF00FF00" "FF0000FF")
cycle_period=5s period=5s
) )
color breathing_red = breathe_color( color breathing_red = breathe_color(
base_color=red base_color=red
@ -485,8 +485,8 @@ animation.register_user_function("custom_palette", create_custom_palette)
```berry ```berry
# Use in DSL # Use in DSL
animation dynamic_anim = rich_palette( animation dynamic_anim = rich_palette(
palette=custom_palette(0xFF0000, 200) colors=custom_palette(0xFF0000, 200)
cycle_period=3s period=3s
) )
``` ```
@ -783,7 +783,7 @@ sequence cylon_eye repeat forever {
# Option 3: Parametric repeat count # Option 3: Parametric repeat count
sequence rainbow_cycle repeat palette.size times { sequence rainbow_cycle repeat palette.size times {
play animation for 1s play animation for 1s
palette.next = 1 colors.next = 1
} }
``` ```
@ -1064,7 +1064,7 @@ template animation shutter_effect {
set strip_len = strip_length() set strip_len = strip_length()
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration) set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
color col = color_cycle(palette=colors, cycle_period=0) color col = color_cycle(colors=colors, period=0)
animation shutter = beacon_animation( animation shutter = beacon_animation(
color = col color = col
@ -1136,7 +1136,7 @@ template animation fade_effect {
# 'duration' is an implicit parameter - no need to declare it # 'duration' is an implicit parameter - no need to declare it
set oscillator = sawtooth(min_value=0, max_value=255, duration=duration) set oscillator = sawtooth(min_value=0, max_value=255, duration=duration)
color col = color_cycle(palette=colors, cycle_period=0) color col = color_cycle(colors=colors, period=0)
animation test = solid(color=col) animation test = solid(color=col)
# 'opacity' is also implicit # 'opacity' is also implicit

View File

@ -321,7 +321,7 @@ template animation shutter_effect {
param duration type time min 0 max 3600 default 5 nillable false param duration type time min 0 max 3600 default 5 nillable false
set strip_len = strip_length() set strip_len = strip_length()
color col = color_cycle(palette=colors, cycle_period=0) color col = color_cycle(colors=colors, period=0)
animation shutter = beacon_animation( animation shutter = beacon_animation(
color = col color = col
@ -351,8 +351,8 @@ class shutter_effect_animation : animation.engine_proxy
var strip_len_ = animation.strip_length(engine) var strip_len_ = animation.strip_length(engine)
var col_ = animation.color_cycle(engine) var col_ = animation.color_cycle(engine)
col_.palette = animation.create_closure_value(engine, def (engine) return self.colors end) col_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
col_.cycle_period = 0 col_.period = 0
var shutter_ = animation.beacon_animation(engine) var shutter_ = animation.beacon_animation(engine)
shutter_.color = col_ shutter_.color = col_

View File

@ -54,7 +54,7 @@ palette fire_colors = [
(255, 0xFFFF00) # Yellow (255, 0xFFFF00) # Yellow
] ]
animation fire_effect = palette_animation(palette=fire_colors, period=2s, intensity=255) animation fire_effect = palette_animation(colors=fire_colors, period=2s, intensity=255)
run fire_effect run fire_effect
``` ```
@ -131,7 +131,7 @@ set cosine_val = cosine_osc(min_value=0, max_value=27, duration=5s)
# Create color cycle # Create color cycle
palette eye_palette = [red, yellow, green, violet] palette eye_palette = [red, yellow, green, violet]
color eye_color = color_cycle(palette=eye_palette, cycle_period=0) color eye_color = color_cycle(colors=eye_palette, period=0)
# Create beacon animation # Create beacon animation
animation red_eye = beacon_animation( animation red_eye = beacon_animation(
@ -290,7 +290,7 @@ run nested_pattern
set triangle_pos = triangle(min_value=0, max_value=29, period=3s) set triangle_pos = triangle(min_value=0, max_value=29, period=3s)
set cosine_pos = cosine_osc(min_value=0, max_value=29, period=3s) set cosine_pos = cosine_osc(min_value=0, max_value=29, period=3s)
color eye_color = color_cycle(palette=[red, yellow, green, blue], cycle_period=0) color eye_color = color_cycle(colors=[red, yellow, green, blue], period=0)
animation moving_eye = beacon_animation( animation moving_eye = beacon_animation(
color=eye_color color=eye_color
pos=triangle_pos pos=triangle_pos
@ -445,15 +445,15 @@ template breathing_rainbow {
param base_brightness param base_brightness
# Create rainbow palette # Create rainbow palette
palette rainbow = [ colors rainbow = [
(0, red), (42, orange), (85, yellow) (0, red), (42, orange), (85, yellow)
(128, green), (170, blue), (213, purple), (255, red) (128, green), (170, blue), (213, purple), (255, red)
] ]
# Create cycling rainbow color # Create cycling rainbow color
color rainbow_cycle = color_cycle( color rainbow_cycle = color_cycle(
palette=rainbow colors=rainbow
cycle_period=cycle_time period=cycle_time
) )
# Create breathing animation with rainbow colors # Create breathing animation with rainbow colors

View File

@ -29,8 +29,8 @@ Create smooth color transitions:
```berry ```berry
# Use predefined rainbow palette # Use predefined rainbow palette
animation rainbow_cycle = rich_palette( animation rainbow_cycle = rich_palette(
palette=PALETTE_RAINBOW colors=PALETTE_RAINBOW
cycle_period=5s period=5s
transition_type=1 transition_type=1
) )
@ -53,8 +53,8 @@ palette sunset = [
# Create palette animation # Create palette animation
animation sunset_glow = rich_palette( animation sunset_glow = rich_palette(
palette=sunset colors=sunset
cycle_period=8s period=8s
transition_type=1 transition_type=1
) )
@ -138,8 +138,8 @@ run breathing
### Fire Effect ### Fire Effect
```berry ```berry
animation fire = rich_palette( animation fire = rich_palette(
palette=PALETTE_FIRE colors=PALETTE_FIRE
cycle_period=2s period=2s
transition_type=1 transition_type=1
) )
@ -170,7 +170,7 @@ template animation shutter_effect {
param duration type time min 0 max 3600 default 5 nillable false param duration type time min 0 max 3600 default 5 nillable false
set strip_len = strip_length() set strip_len = strip_length()
color col = color_cycle(palette=colors, cycle_period=0) color col = color_cycle(colors=colors, period=0)
animation shutter = beacon_animation( animation shutter = beacon_animation(
color = col color = col

View File

@ -346,7 +346,7 @@ _detect_and_cache_symbol(name)
**Palette Detection:** **Palette Detection:**
```berry ```berry
# DSL: animation rainbow = rich_palette_animation(palette=PALETTE_RAINBOW) # DSL: animation rainbow = rich_palette_animation(colors=PALETTE_RAINBOW)
# Detection: PALETTE_RAINBOW exists in animation module, isinstance(obj, bytes) # Detection: PALETTE_RAINBOW exists in animation module, isinstance(obj, bytes)
# Result: SymbolEntry("PALETTE_RAINBOW", "palette", bytes_instance, true) # Result: SymbolEntry("PALETTE_RAINBOW", "palette", bytes_instance, true)
# Reference: "animation.PALETTE_RAINBOW" # Reference: "animation.PALETTE_RAINBOW"

View File

@ -164,8 +164,8 @@ dim_blue.opacity = bright(30)
```berry ```berry
def custom_fire(engine, intensity, speed) def custom_fire(engine, intensity, speed)
var color_provider = animation.rich_palette(engine) var color_provider = animation.rich_palette(engine)
color_provider.palette = animation.PALETTE_FIRE color_provider.colors = animation.PALETTE_FIRE
color_provider.cycle_period = speed color_provider.period = speed
var fire_anim = animation.filled(engine) var fire_anim = animation.filled(engine)
fire_anim.color_provider = color_provider fire_anim.color_provider = color_provider
@ -237,8 +237,8 @@ right_pulse.position = pulse_at(25, 3, 2000)
def rainbow_twinkle(engine, base_speed, twinkle_density) def rainbow_twinkle(engine, base_speed, twinkle_density)
# Create base rainbow animation # Create base rainbow animation
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.palette = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = base_speed rainbow_provider.period = base_speed
var base_anim = animation.filled(engine) var base_anim = animation.filled(engine)
base_anim.color_provider = rainbow_provider base_anim.color_provider = rainbow_provider
@ -289,10 +289,10 @@ animation.register_user_function("custom_palette", create_custom_palette)
``` ```
```berry ```berry
# Use dynamic palette in DSL # Use dynamic colors in DSL
animation gradient_effect = rich_palette( animation gradient_effect = rich_palette(
palette=custom_palette(0xFF6B35, 5, 255) colors=custom_palette(0xFF6B35, 5, 255)
cycle_period=4s period=4s
) )
run gradient_effect run gradient_effect

View File

@ -184,7 +184,7 @@ class FireAnimation : animation.animation
# Create default fire palette on demand # Create default fire palette on demand
var fire_provider = animation.rich_palette(self.engine) var fire_provider = animation.rich_palette(self.engine)
fire_provider.colors = animation.PALETTE_FIRE fire_provider.colors = animation.PALETTE_FIRE
fire_provider.cycle_period = 0 # Use value-based color mapping, not time-based fire_provider.period = 0 # Use value-based color mapping, not time-based
fire_provider.transition_type = 1 # Use sine transition (smooth) fire_provider.transition_type = 1 # Use sine transition (smooth)
fire_provider.brightness = 255 fire_provider.brightness = 255
resolved_color = fire_provider resolved_color = fire_provider

View File

@ -47,7 +47,7 @@ class NoiseAnimation : animation.animation
if self.color == nil if self.color == nil
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 rainbow_provider.transition_type = 1
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
self.color = rainbow_provider self.color = rainbow_provider
@ -100,7 +100,7 @@ class NoiseAnimation : animation.animation
var gradient_provider = animation.rich_palette(self.engine) var gradient_provider = animation.rich_palette(self.engine)
gradient_provider.colors = palette gradient_provider.colors = palette
gradient_provider.cycle_period = 5000 gradient_provider.period = 5000
gradient_provider.transition_type = 1 gradient_provider.transition_type = 1
gradient_provider.brightness = 255 gradient_provider.brightness = 255
@ -261,7 +261,7 @@ def noise_rainbow(engine)
# Set up rainbow color provider # Set up rainbow color provider
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 rainbow_provider.transition_type = 1
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
anim.color = rainbow_provider anim.color = rainbow_provider
@ -288,7 +288,7 @@ def noise_fractal(engine)
# Set up rainbow color provider # Set up rainbow color provider
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 rainbow_provider.transition_type = 1
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
anim.color = rainbow_provider anim.color = rainbow_provider

View File

@ -18,7 +18,7 @@ class RichPaletteAnimation : animation.animation
static var PARAMS = animation.enc_params({ static var PARAMS = animation.enc_params({
# RichPaletteColorProvider parameters (forwarded to internal provider) # RichPaletteColorProvider parameters (forwarded to internal provider)
"colors": {"type": "instance", "default": nil}, "colors": {"type": "instance", "default": nil},
"cycle_period": {"min": 0, "default": 5000}, "period": {"min": 0, "default": 5000},
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.SINE}, "transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.SINE},
"brightness": {"min": 0, "max": 255, "default": 255} "brightness": {"min": 0, "max": 255, "default": 255}
}) })
@ -44,7 +44,7 @@ class RichPaletteAnimation : animation.animation
def on_param_changed(name, value) def on_param_changed(name, value)
super(self).on_param_changed(name, value) super(self).on_param_changed(name, value)
# Forward rich palette parameters to internal color provider # Forward rich palette parameters to internal color provider
if name == "colors" || name == "cycle_period" || name == "transition_type" || if name == "colors" || name == "period" || name == "transition_type" ||
name == "brightness" name == "brightness"
# Set parameter on internal color provider # Set parameter on internal color provider
self.color_provider.set_param(name, value) self.color_provider.set_param(name, value)

View File

@ -234,7 +234,7 @@ def wave_rainbow_sine(engine)
# Set up rainbow color provider # Set up rainbow color provider
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 # sine transition rainbow_provider.transition_type = 1 # sine transition
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
anim.color = rainbow_provider anim.color = rainbow_provider

View File

@ -71,7 +71,7 @@ class PlasmaAnimation : animation.animation
if self.color == nil if self.color == nil
var rainbow_provider = animation.rich_palette(self.engine) var rainbow_provider = animation.rich_palette(self.engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 rainbow_provider.transition_type = 1
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
self.color = rainbow_provider self.color = rainbow_provider
@ -90,7 +90,7 @@ class PlasmaAnimation : animation.animation
# Reset to default rainbow palette when color is set to nil # Reset to default rainbow palette when color is set to nil
var rainbow_provider = animation.rich_palette(self.engine) var rainbow_provider = animation.rich_palette(self.engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 rainbow_provider.transition_type = 1
rainbow_provider.brightness = 255 rainbow_provider.brightness = 255
# Set the parameter directly to avoid recursion # Set the parameter directly to avoid recursion

View File

@ -238,7 +238,7 @@ end
def sparkle_rainbow(engine) def sparkle_rainbow(engine)
var rainbow_provider = animation.rich_palette(engine) var rainbow_provider = animation.rich_palette(engine)
rainbow_provider.colors = animation.PALETTE_RAINBOW rainbow_provider.colors = animation.PALETTE_RAINBOW
rainbow_provider.cycle_period = 5000 rainbow_provider.period = 5000
rainbow_provider.transition_type = 1 # sine transition rainbow_provider.transition_type = 1 # sine transition
var anim = animation.sparkle_animation(engine) var anim = animation.sparkle_animation(engine)

View File

@ -4,8 +4,8 @@
# No transitions or interpolation - just instant color changes. # No transitions or interpolation - just instant color changes.
# #
# Modes: # Modes:
# - Auto-cycle: cycle_period > 0 - colors change automatically at regular intervals # - Auto-cycle: period > 0 - colors change automatically at regular intervals
# - Manual-only: cycle_period = 0 - colors only change when 'next' parameter is set to 1 # - Manual-only: period = 0 - colors only change when 'next' parameter is set to 1
# #
# Follows the parameterized class specification: # Follows the parameterized class specification:
# - Constructor takes only 'engine' parameter # - Constructor takes only 'engine' parameter
@ -21,7 +21,7 @@ class ColorCycleColorProvider : animation.color_provider
# Parameter definitions # Parameter definitions
static var PARAMS = animation.enc_params({ static var PARAMS = animation.enc_params({
"colors": {"type": "bytes", "default":nil}, "colors": {"type": "bytes", "default":nil},
"cycle_period": {"min": 0, "default": 5000}, # 0 = manual only, >0 = auto cycle time in ms "period": {"min": 0, "default": 5000}, # 0 = manual only, >0 = auto cycle time in ms
"next": {"default": 0}, # Write `<n>` to move to next <n> colors "next": {"default": 0}, # Write `<n>` to move to next <n> colors
"palette_size": {"type": "int", "default": 3} # Read-only: number of colors in palette "palette_size": {"type": "int", "default": 3} # Read-only: number of colors in palette
}) })
@ -127,12 +127,12 @@ class ColorCycleColorProvider : animation.color_provider
# @return int - Color in ARGB format (0xAARRGGBB) # @return int - Color in ARGB format (0xAARRGGBB)
def produce_value(name, time_ms) def produce_value(name, time_ms)
# Get parameter values using virtual member access # Get parameter values using virtual member access
var cycle_period = self.cycle_period var period = self.period
# Get the number of colors in the palette # Get the number of colors in the palette
var palette_size = self._get_palette_size() var palette_size = self._get_palette_size()
if (palette_size <= 1) || (cycle_period == 0) # no cycling stop here if (palette_size <= 1) || (period == 0) # no cycling stop here
var idx = self.current_index var idx = self.current_index
if (idx >= palette_size) idx = palette_size - 1 end if (idx >= palette_size) idx = palette_size - 1 end
if (idx < 0) idx = 0 end if (idx < 0) idx = 0 end
@ -148,8 +148,8 @@ class ColorCycleColorProvider : animation.color_provider
end end
# Auto-cycle mode: calculate which color to show based on time (brutal switching using integer math) # Auto-cycle mode: calculate which color to show based on time (brutal switching using integer math)
var time_in_cycle = time_ms % cycle_period var time_in_cycle = time_ms % period
var color_index = tasmota.scale_uint(time_in_cycle, 0, cycle_period - 1, 0, palette_size - 1) var color_index = tasmota.scale_uint(time_in_cycle, 0, period - 1, 0, palette_size - 1)
# Clamp to valid range (safety check) # Clamp to valid range (safety check)
if color_index >= palette_size if color_index >= palette_size
@ -217,7 +217,7 @@ class ColorCycleColorProvider : animation.color_provider
# String representation of the provider # String representation of the provider
def tostring() def tostring()
return f"ColorCycleColorProvider(palette_size={self._get_palette_size()}, cycle_period={self.cycle_period}, mode={self.cycle_period ? 'manual' :: 'auto'}, current_index={self.current_index})" return f"ColorCycleColorProvider(palette_size={self._get_palette_size()}, period={self.period}, mode={self.period ? 'manual' :: 'auto'}, current_index={self.current_index})"
end end
end end

View File

@ -33,7 +33,7 @@ import "./core/param_encoder" as encode_constraints
#@ solidify:RichPaletteColorProvider,weak #@ solidify:RichPaletteColorProvider,weak
class RichPaletteColorProvider : animation.color_provider class RichPaletteColorProvider : animation.color_provider
# Non-parameter instance variables only # Non-parameter instance variables only
var _slots_arr # Constructed array of timestamp slots, based on cycle_period var _slots_arr # Constructed array of timestamp slots, based on period
var _value_arr # Constructed array of value slots (always 0-255 range) var _value_arr # Constructed array of value slots (always 0-255 range)
var _slots # Number of slots in the palette var _slots # Number of slots in the palette
var _current_color # Current interpolated color (calculated during update) var _current_color # Current interpolated color (calculated during update)
@ -43,7 +43,7 @@ class RichPaletteColorProvider : animation.color_provider
# Parameter definitions # Parameter definitions
static var PARAMS = animation.enc_params({ static var PARAMS = animation.enc_params({
"colors": {"type": "bytes", "default": nil}, # Palette bytes or predefined palette constant "colors": {"type": "bytes", "default": nil}, # Palette bytes or predefined palette constant
"cycle_period": {"min": 0, "default": 5000}, # 5 seconds default, 0 = value-based only "period": {"min": 0, "default": 5000}, # 5 seconds default, 0 = value-based only
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.LINEAR} "transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.LINEAR}
# brightness parameter inherited from ColorProvider base class # brightness parameter inherited from ColorProvider base class
}) })
@ -75,7 +75,7 @@ class RichPaletteColorProvider : animation.color_provider
# @param value: any - New value of the parameter # @param value: any - New value of the parameter
def on_param_changed(name, value) def on_param_changed(name, value)
super(self).on_param_changed(name, value) super(self).on_param_changed(name, value)
if name == "cycle_period" || name == "colors" if name == "period" || name == "colors"
if (self._slots_arr != nil) || (self._value_arr != nil) if (self._slots_arr != nil) || (self._value_arr != nil)
# only if they were already computed # only if they were already computed
self._recompute_palette() self._recompute_palette()
@ -120,14 +120,14 @@ class RichPaletteColorProvider : animation.color_provider
# Recompute palette slots and metadata # Recompute palette slots and metadata
def _recompute_palette() def _recompute_palette()
# Compute slots_arr based on 'cycle_period' # Compute slots_arr based on 'period'
var cycle_period = self.cycle_period var period = self.period
var palette_bytes = self._get_palette_bytes() var palette_bytes = self._get_palette_bytes()
self._slots = size(palette_bytes) / 4 self._slots = size(palette_bytes) / 4
# Recompute palette with new cycle period (only if > 0 for time-based cycling) # Recompute palette with new cycle period (only if > 0 for time-based cycling)
if cycle_period > 0 && palette_bytes != nil if period > 0 && palette_bytes != nil
self._slots_arr = self._parse_palette(0, cycle_period - 1) self._slots_arr = self._parse_palette(0, period - 1)
else else
self._slots_arr = nil self._slots_arr = nil
end end
@ -271,11 +271,11 @@ class RichPaletteColorProvider : animation.color_provider
end end
# Get parameter values using virtual member access # Get parameter values using virtual member access
var cycle_period = self.cycle_period var period = self.period
var brightness = self.brightness var brightness = self.brightness
# If cycle_period is 0, return static color (first color in palette) # If period is 0, return static color (first color in palette)
if cycle_period == 0 if period == 0
var bgrt0 = palette_bytes.get(0, 4) var bgrt0 = palette_bytes.get(0, 4)
var r = (bgrt0 >> 8) & 0xFF var r = (bgrt0 >> 8) & 0xFF
var g = (bgrt0 >> 16) & 0xFF var g = (bgrt0 >> 16) & 0xFF
@ -295,7 +295,7 @@ class RichPaletteColorProvider : animation.color_provider
# Calculate position in cycle using start_time # Calculate position in cycle using start_time
var elapsed = time_ms - self.start_time var elapsed = time_ms - self.start_time
var past = elapsed % cycle_period var past = elapsed % period
# Find slot (exact algorithm from Animate_palette) # Find slot (exact algorithm from Animate_palette)
var slots = self._slots var slots = self._slots
@ -520,7 +520,7 @@ class RichPaletteColorProvider : animation.color_provider
# String representation # String representation
def tostring() def tostring()
try try
return f"RichPaletteColorProvider(slots={self._slots}, cycle_period={self.cycle_period})" return f"RichPaletteColorProvider(slots={self._slots}, period={self.period})"
except .. except ..
return "RichPaletteColorProvider(uninitialized)" return "RichPaletteColorProvider(uninitialized)"
end end

View File

@ -315,7 +315,7 @@ static const bvalue be_ktab_class_RichPaletteAnimation[13] = {
/* K6 */ be_nested_str_weak(start), /* K6 */ be_nested_str_weak(start),
/* K7 */ be_nested_str_weak(on_param_changed), /* K7 */ be_nested_str_weak(on_param_changed),
/* K8 */ be_nested_str_weak(colors), /* K8 */ be_nested_str_weak(colors),
/* K9 */ be_nested_str_weak(cycle_period), /* K9 */ be_nested_str_weak(period),
/* K10 */ be_nested_str_weak(transition_type), /* K10 */ be_nested_str_weak(transition_type),
/* K11 */ be_nested_str_weak(brightness), /* K11 */ be_nested_str_weak(brightness),
/* K12 */ be_nested_str_weak(set_param), /* K12 */ be_nested_str_weak(set_param),
@ -463,10 +463,10 @@ be_local_class(RichPaletteAnimation,
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { { be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
be_const_map( * be_nested_map(4, be_const_map( * be_nested_map(4,
( (struct bmapnode*) &(const bmapnode[]) { ( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400050200010005) }, { be_const_key_weak(period, -1), be_const_bytes_instance(050000018813) },
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0605) }, { be_const_key_weak(colors, -1), be_const_bytes_instance(0C0605) },
{ be_const_key_weak(brightness, -1), be_const_bytes_instance(07000001FF0001FF00) }, { be_const_key_weak(brightness, -1), be_const_bytes_instance(07000001FF0001FF00) },
{ be_const_key_weak(cycle_period, 0), be_const_bytes_instance(050000018813) }, { be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400050200010005) },
})) ) } )) }, })) ) } )) },
{ be_const_key_weak(color_provider, -1), be_const_var(0) }, { be_const_key_weak(color_provider, -1), be_const_var(0) },
})), })),
@ -526,7 +526,7 @@ be_local_closure(noise_rainbow, /* name */
/* K2 */ be_nested_str_weak(rich_palette), /* K2 */ be_nested_str_weak(rich_palette),
/* K3 */ be_nested_str_weak(colors), /* K3 */ be_nested_str_weak(colors),
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW), /* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
/* K5 */ be_nested_str_weak(cycle_period), /* K5 */ be_nested_str_weak(period),
/* K6 */ be_nested_str_weak(transition_type), /* K6 */ be_nested_str_weak(transition_type),
/* K7 */ be_const_int(1), /* K7 */ be_const_int(1),
/* K8 */ be_nested_str_weak(brightness), /* K8 */ be_nested_str_weak(brightness),
@ -1768,7 +1768,7 @@ static const bvalue be_ktab_class_FireAnimation[47] = {
/* K38 */ be_nested_str_weak(rich_palette), /* K38 */ be_nested_str_weak(rich_palette),
/* K39 */ be_nested_str_weak(colors), /* K39 */ be_nested_str_weak(colors),
/* K40 */ be_nested_str_weak(PALETTE_FIRE), /* K40 */ be_nested_str_weak(PALETTE_FIRE),
/* K41 */ be_nested_str_weak(cycle_period), /* K41 */ be_nested_str_weak(period),
/* K42 */ be_nested_str_weak(transition_type), /* K42 */ be_nested_str_weak(transition_type),
/* K43 */ be_nested_str_weak(brightness), /* K43 */ be_nested_str_weak(brightness),
/* K44 */ be_nested_str_weak(is_color_provider), /* K44 */ be_nested_str_weak(is_color_provider),
@ -2401,8 +2401,8 @@ static const bvalue be_ktab_class_RichPaletteColorProvider[58] = {
/* K26 */ be_nested_str_weak(_X2C_X23_X2502X_X2502X_X2502X_X20_X25_X2E1f_X25_X25), /* K26 */ be_nested_str_weak(_X2C_X23_X2502X_X2502X_X2502X_X20_X25_X2E1f_X25_X25),
/* K27 */ be_const_real_hex(0x41200000), /* K27 */ be_const_real_hex(0x41200000),
/* K28 */ be_nested_str_weak(_X29_X3B), /* K28 */ be_nested_str_weak(_X29_X3B),
/* K29 */ be_nested_str_weak(RichPaletteColorProvider_X28slots_X3D_X25s_X2C_X20cycle_period_X3D_X25s_X29), /* K29 */ be_nested_str_weak(RichPaletteColorProvider_X28slots_X3D_X25s_X2C_X20period_X3D_X25s_X29),
/* K30 */ be_nested_str_weak(cycle_period), /* K30 */ be_nested_str_weak(period),
/* K31 */ be_nested_str_weak(RichPaletteColorProvider_X28uninitialized_X29), /* K31 */ be_nested_str_weak(RichPaletteColorProvider_X28uninitialized_X29),
/* K32 */ be_nested_str_weak(_current_color), /* K32 */ be_nested_str_weak(_current_color),
/* K33 */ be_nested_str_weak(_get_color_at_index), /* K33 */ be_nested_str_weak(_get_color_at_index),
@ -3596,7 +3596,7 @@ be_local_class(RichPaletteColorProvider,
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { { be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
be_const_map( * be_nested_map(3, be_const_map( * be_nested_map(3,
( (struct bmapnode*) &(const bmapnode[]) { ( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key_weak(cycle_period, 1), be_const_bytes_instance(050000018813) }, { be_const_key_weak(period, 1), be_const_bytes_instance(050000018813) },
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400010200010005) }, { be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400010200010005) },
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) }, { be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) },
})) ) } )) }, })) ) } )) },
@ -3722,7 +3722,7 @@ be_local_closure(unregister_event_handler, /* name */
// compact class 'ColorCycleColorProvider' ktab size: 27, total: 54 (saved 216 bytes) // compact class 'ColorCycleColorProvider' ktab size: 27, total: 54 (saved 216 bytes)
static const bvalue be_ktab_class_ColorCycleColorProvider[27] = { static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
/* K0 */ be_nested_str_weak(cycle_period), /* K0 */ be_nested_str_weak(period),
/* K1 */ be_nested_str_weak(_get_palette_size), /* K1 */ be_nested_str_weak(_get_palette_size),
/* K2 */ be_const_int(1), /* K2 */ be_const_int(1),
/* K3 */ be_const_int(0), /* K3 */ be_const_int(0),
@ -3732,7 +3732,7 @@ static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
/* K7 */ be_nested_str_weak(apply_brightness), /* K7 */ be_nested_str_weak(apply_brightness),
/* K8 */ be_nested_str_weak(tasmota), /* K8 */ be_nested_str_weak(tasmota),
/* K9 */ be_nested_str_weak(scale_uint), /* K9 */ be_nested_str_weak(scale_uint),
/* K10 */ be_nested_str_weak(ColorCycleColorProvider_X28palette_size_X3D_X25s_X2C_X20cycle_period_X3D_X25s_X2C_X20mode_X3D_X25s_X2C_X20current_index_X3D_X25s_X29), /* K10 */ be_nested_str_weak(ColorCycleColorProvider_X28palette_size_X3D_X25s_X2C_X20period_X3D_X25s_X2C_X20mode_X3D_X25s_X2C_X20current_index_X3D_X25s_X29),
/* K11 */ be_nested_str_weak(manual), /* K11 */ be_nested_str_weak(manual),
/* K12 */ be_nested_str_weak(auto), /* K12 */ be_nested_str_weak(auto),
/* K13 */ be_nested_str_weak(colors), /* K13 */ be_nested_str_weak(colors),
@ -4205,10 +4205,10 @@ be_local_class(ColorCycleColorProvider,
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, { { be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
be_const_map( * be_nested_map(4, be_const_map( * be_nested_map(4,
( (struct bmapnode*) &(const bmapnode[]) { ( (struct bmapnode*) &(const bmapnode[]) {
{ be_const_key_weak(next, 2), be_const_bytes_instance(040000) }, { be_const_key_weak(period, 2), be_const_bytes_instance(050000018813) },
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) }, { be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) },
{ be_const_key_weak(palette_size, -1), be_const_bytes_instance(0C000300) }, { be_const_key_weak(palette_size, 3), be_const_bytes_instance(0C000300) },
{ be_const_key_weak(cycle_period, -1), be_const_bytes_instance(050000018813) }, { be_const_key_weak(next, -1), be_const_bytes_instance(040000) },
})) ) } )) }, })) ) } )) },
{ be_const_key_weak(init, -1), be_const_closure(class_ColorCycleColorProvider_init_closure) }, { be_const_key_weak(init, -1), be_const_closure(class_ColorCycleColorProvider_init_closure) },
{ be_const_key_weak(produce_value, 0), be_const_closure(class_ColorCycleColorProvider_produce_value_closure) }, { be_const_key_weak(produce_value, 0), be_const_closure(class_ColorCycleColorProvider_produce_value_closure) },
@ -7843,7 +7843,7 @@ static const bvalue be_ktab_class_NoiseAnimation[49] = {
/* K12 */ be_nested_str_weak(rich_palette), /* K12 */ be_nested_str_weak(rich_palette),
/* K13 */ be_nested_str_weak(colors), /* K13 */ be_nested_str_weak(colors),
/* K14 */ be_nested_str_weak(PALETTE_RAINBOW), /* K14 */ be_nested_str_weak(PALETTE_RAINBOW),
/* K15 */ be_nested_str_weak(cycle_period), /* K15 */ be_nested_str_weak(period),
/* K16 */ be_nested_str_weak(transition_type), /* K16 */ be_nested_str_weak(transition_type),
/* K17 */ be_nested_str_weak(brightness), /* K17 */ be_nested_str_weak(brightness),
/* K18 */ be_nested_str_weak(int), /* K18 */ be_nested_str_weak(int),
@ -10610,7 +10610,7 @@ be_local_closure(wave_rainbow_sine, /* name */
/* K2 */ be_nested_str_weak(rich_palette), /* K2 */ be_nested_str_weak(rich_palette),
/* K3 */ be_nested_str_weak(colors), /* K3 */ be_nested_str_weak(colors),
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW), /* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
/* K5 */ be_nested_str_weak(cycle_period), /* K5 */ be_nested_str_weak(period),
/* K6 */ be_nested_str_weak(transition_type), /* K6 */ be_nested_str_weak(transition_type),
/* K7 */ be_const_int(1), /* K7 */ be_const_int(1),
/* K8 */ be_nested_str_weak(brightness), /* K8 */ be_nested_str_weak(brightness),
@ -17956,7 +17956,7 @@ be_local_closure(noise_fractal, /* name */
/* K2 */ be_nested_str_weak(rich_palette), /* K2 */ be_nested_str_weak(rich_palette),
/* K3 */ be_nested_str_weak(colors), /* K3 */ be_nested_str_weak(colors),
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW), /* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
/* K5 */ be_nested_str_weak(cycle_period), /* K5 */ be_nested_str_weak(period),
/* K6 */ be_nested_str_weak(transition_type), /* K6 */ be_nested_str_weak(transition_type),
/* K7 */ be_const_int(1), /* K7 */ be_const_int(1),
/* K8 */ be_nested_str_weak(brightness), /* K8 */ be_nested_str_weak(brightness),

View File

@ -71,7 +71,7 @@ class ColorCycleAnimationTest
var custom_palette = bytes("FFFF0000FF00FF00") # Red and Green in AARRGGBB format var custom_palette = bytes("FFFF0000FF00FF00") # Red and Green in AARRGGBB format
var custom_provider = animation.color_cycle(engine) var custom_provider = animation.color_cycle(engine)
custom_provider.colors = custom_palette custom_provider.colors = custom_palette
custom_provider.cycle_period = 2000 custom_provider.period = 2000
var anim2 = animation.solid(engine) var anim2 = animation.solid(engine)
anim2.color = custom_provider anim2.color = custom_provider
@ -87,7 +87,7 @@ class ColorCycleAnimationTest
# Check provider properties # Check provider properties
self.assert_equal(color_provider2._get_palette_size(), 2, "Custom colors has 2 colors") self.assert_equal(color_provider2._get_palette_size(), 2, "Custom colors has 2 colors")
self.assert_equal(color_provider2.cycle_period, 2000, "Custom cycle period is 2000ms") self.assert_equal(color_provider2.period, 2000, "Custom cycle period is 2000ms")
end end
def test_update_and_render() def test_update_and_render()
@ -95,7 +95,7 @@ class ColorCycleAnimationTest
var colors = bytes("FFFF0000FF0000FF") # Red and Blue in AARRGGBB format var colors = bytes("FFFF0000FF0000FF") # Red and Blue in AARRGGBB format
var provider = animation.color_cycle(engine) var provider = animation.color_cycle(engine)
provider.colors = colors provider.colors = colors
provider.cycle_period = 1000 # 1 second cycle provider.period = 1000 # 1 second cycle
var anim = animation.solid(engine) var anim = animation.solid(engine)
anim.color = provider anim.color = provider
@ -138,12 +138,12 @@ class ColorCycleAnimationTest
end end
def test_manual_only_mode() def test_manual_only_mode()
print("Testing manual-only mode (cycle_period = 0)...") print("Testing manual-only mode (period = 0)...")
# Create animation with manual-only color provider # Create animation with manual-only color provider
var manual_provider = animation.color_cycle(engine) var manual_provider = animation.color_cycle(engine)
manual_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format manual_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format
manual_provider.cycle_period = 0 # Manual-only mode manual_provider.period = 0 # Manual-only mode
var manual_anim = animation.solid(engine) var manual_anim = animation.solid(engine)
manual_anim.color = manual_provider manual_anim.color = manual_provider
@ -192,7 +192,7 @@ class ColorCycleAnimationTest
# Test direct creation without factory method (following new parameterized pattern) # Test direct creation without factory method (following new parameterized pattern)
var provider = animation.color_cycle(engine) var provider = animation.color_cycle(engine)
provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format
provider.cycle_period = 3000 # 3 second cycle period provider.period = 3000 # 3 second cycle period
var anim = animation.solid(engine) var anim = animation.solid(engine)
anim.color = provider anim.color = provider
@ -209,7 +209,7 @@ class ColorCycleAnimationTest
# Check provider properties # Check provider properties
self.assert_equal(color_provider3._get_palette_size(), 3, "Palette has 3 colors") self.assert_equal(color_provider3._get_palette_size(), 3, "Palette has 3 colors")
self.assert_equal(color_provider3.cycle_period, 3000, "Cycle period is 3000ms") self.assert_equal(color_provider3.period, 3000, "Cycle period is 3000ms")
# Check animation properties # Check animation properties
self.assert_equal(anim.priority, 10, "Priority is 10") self.assert_equal(anim.priority, 10, "Priority is 10")

View File

@ -54,7 +54,7 @@ def test_color_cycle_bytes_format()
assert(custom_color3 == 0xFFFFFF00, f"Custom color 3 should be 0xFFFFFF00 (alpha forced), got 0x{custom_color3:08X}") assert(custom_color3 == 0xFFFFFF00, f"Custom color 3 should be 0xFFFFFF00 (alpha forced), got 0x{custom_color3:08X}")
# Test 6: Test auto-cycle mode # Test 6: Test auto-cycle mode
provider.cycle_period = 4000 # 4 seconds for 4 colors = 1 second per color provider.period = 4000 # 4 seconds for 4 colors = 1 second per color
# At time 0, should be first color # At time 0, should be first color
engine.time_ms = 0 engine.time_ms = 0
@ -74,7 +74,7 @@ def test_color_cycle_bytes_format()
assert(cycle_color3 == custom_color3, f"Cycle color at t=3000 should match fourth color") assert(cycle_color3 == custom_color3, f"Cycle color at t=3000 should match fourth color")
# Test 7: Test manual mode # Test 7: Test manual mode
provider.cycle_period = 0 # Manual mode provider.period = 0 # Manual mode
provider.current_index = 1 provider.current_index = 1
var manual_color = provider.produce_value("color", 5000) var manual_color = provider.produce_value("color", 5000)

View File

@ -99,7 +99,7 @@ def test_crenel_with_dynamic_color_provider()
# Create a palette color provider that changes over time # Create a palette color provider that changes over time
var palette_provider = animation.color_cycle(engine) var palette_provider = animation.color_cycle(engine)
palette_provider.colors = bytes("FF0000FFFF00FF00FFFF0000FFFFFF00") # BGRY palette in AARRGGBB format palette_provider.colors = bytes("FF0000FFFF00FF00FFFF0000FFFFFF00") # BGRY palette in AARRGGBB format
palette_provider.cycle_period = 2000 # 2 second cycle palette_provider.period = 2000 # 2 second cycle
# Create animation with new parameterized pattern # Create animation with new parameterized pattern
var crenel = animation.crenel_animation(engine) var crenel = animation.crenel_animation(engine)

View File

@ -17,7 +17,7 @@ def test_demo_shutter_patterns()
" param colors type palette\n" + " param colors type palette\n" +
" param duration\n" + " param duration\n" +
" \n" + " \n" +
" color col1 = color_cycle(palette=colors, cycle_period=0)\n" + " color col1 = color_cycle(palette=colors, period=0)\n" +
" animation test_anim = solid(color=col1)\n" + " animation test_anim = solid(color=col1)\n" +
" \n" + " \n" +
" sequence shutter_seq repeat forever {\n" + " sequence shutter_seq repeat forever {\n" +
@ -44,7 +44,7 @@ def test_demo_shutter_patterns()
# Test 2: The col1.next = 1 pattern # Test 2: The col1.next = 1 pattern
print(" Testing color.next assignment...") print(" Testing color.next assignment...")
var color_next = "color col1 = color_cycle(palette=[red, green], cycle_period=0)\n" + var color_next = "color col1 = color_cycle(palette=[red, green], period=0)\n" +
"col1.next = 1\n" + "col1.next = 1\n" +
"animation test_anim = solid(color=col1)\n" + "animation test_anim = solid(color=col1)\n" +
"run test_anim" "run test_anim"
@ -87,7 +87,7 @@ def test_demo_shutter_patterns()
" set strip_len2 = (strip_len + 1) / 2\n" + " set strip_len2 = (strip_len + 1) / 2\n" +
" set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)\n" + " set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)\n" +
" \n" + " \n" +
" color col1 = color_cycle(palette=colors, cycle_period=0)\n" + " color col1 = color_cycle(palette=colors, period=0)\n" +
" \n" + " \n" +
" animation shutter_anim = beacon_animation(\n" + " animation shutter_anim = beacon_animation(\n" +
" color = col1\n" + " color = col1\n" +
@ -123,8 +123,8 @@ def test_demo_shutter_patterns()
" set strip_len2 = (strip_len + 1) / 2\n" + " set strip_len2 = (strip_len + 1) / 2\n" +
" set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)\n" + " set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)\n" +
" \n" + " \n" +
" color col1 = color_cycle(palette=colors, cycle_period=0)\n" + " color col1 = color_cycle(palette=colors, period=0)\n" +
" color col2 = color_cycle(palette=colors, cycle_period=0)\n" + " color col2 = color_cycle(palette=colors, period=0)\n" +
" col2.next = 1\n" + " col2.next = 1\n" +
" \n" + " \n" +
" animation shutter_inout = beacon_animation(\n" + " animation shutter_inout = beacon_animation(\n" +

View File

@ -47,7 +47,7 @@ def test_palette_newline_entries()
" (192, 0x00AA00)\n" + " (192, 0x00AA00)\n" +
" (255, 0x00FF00)\n" + " (255, 0x00FF00)\n" +
"]\n" + "]\n" +
"color stream_color = rich_palette(colors=matrix_greens, cycle_period=2s)\n" + "color stream_color = rich_palette(colors=matrix_greens, period=2s)\n" +
"animation stream = solid(color=stream_color)\n" + "animation stream = solid(color=stream_color)\n" +
"run stream" "run stream"
@ -113,7 +113,7 @@ def test_color_provider_newline_syntax()
"palette test_palette = [(0, 0x000000), (255, 0xFFFFFF)]\n" + "palette test_palette = [(0, 0x000000), (255, 0xFFFFFF)]\n" +
"color dynamic_color = rich_palette(\n" + "color dynamic_color = rich_palette(\n" +
" colors=test_palette\n" + " colors=test_palette\n" +
" cycle_period=2s\n" + " period=2s\n" +
" transition_type=LINEAR\n" + " transition_type=LINEAR\n" +
" brightness=255\n" + " brightness=255\n" +
")\n" + ")\n" +
@ -125,7 +125,7 @@ def test_color_provider_newline_syntax()
assert(berry_code != nil, "Should compile color provider with newline syntax") 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, "var dynamic_color_ = animation.rich_palette(engine)") >= 0, "Should generate color provider creation")
assert(string.find(berry_code, "dynamic_color_.colors = test_palette_") >= 0, "Should generate palette assignment") assert(string.find(berry_code, "dynamic_color_.colors = test_palette_") >= 0, "Should generate palette assignment")
assert(string.find(berry_code, "dynamic_color_.cycle_period = 2000") >= 0, "Should generate cycle_period assignment") assert(string.find(berry_code, "dynamic_color_.period = 2000") >= 0, "Should generate period assignment")
print("✓ Color provider newline syntax test passed") print("✓ Color provider newline syntax test passed")
return true return true
@ -174,7 +174,7 @@ def test_complex_example()
"\n" + "\n" +
"color stream_pattern = rich_palette(\n" + "color stream_pattern = rich_palette(\n" +
" colors=matrix_greens\n" + " colors=matrix_greens\n" +
" cycle_period=2s\n" + " period=2s\n" +
" transition_type=LINEAR\n" + " transition_type=LINEAR\n" +
" brightness=255\n" + " brightness=255\n" +
")\n" + ")\n" +

View File

@ -253,7 +253,7 @@ def test_complex_scenario()
var dsl_source = "# Complex cylon eye with restart functionality\n" + var dsl_source = "# Complex cylon eye with restart functionality\n" +
"set strip_len = strip_length()\n" + "set strip_len = strip_length()\n" +
"palette eye_palette = [ red, yellow, green, violet ]\n" + "palette eye_palette = [ red, yellow, green, violet ]\n" +
"color eye_color = color_cycle(colors=eye_palette, cycle_period=0)\n" + "color eye_color = color_cycle(colors=eye_palette, period=0)\n" +
"set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" + "set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
"set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" + "set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
"\n" + "\n" +

View File

@ -116,7 +116,7 @@ class DSLTemplateAnimationTest
" param my_color type palette\n" + " param my_color type palette\n" +
" param my_duration type time\n" + " param my_duration type time\n" +
" \n" + " \n" +
" color col = color_cycle(colors=my_color, cycle_period=0)\n" + " color col = color_cycle(colors=my_color, period=0)\n" +
" animation test = pulsating_animation(color=col, period=my_duration)\n" + " animation test = pulsating_animation(color=col, period=my_duration)\n" +
" run test\n" + " run test\n" +
"}\n" "}\n"
@ -170,7 +170,7 @@ class DSLTemplateAnimationTest
" param colors type palette\n" + " param colors type palette\n" +
" param duration type time\n" + " param duration type time\n" +
" \n" + " \n" +
" color col = color_cycle(colors=colors, cycle_period=0)\n" + " color col = color_cycle(colors=colors, period=0)\n" +
" animation anim = solid(color=col)\n" + " animation anim = solid(color=col)\n" +
" \n" + " \n" +
" sequence seq repeat forever {\n" + " sequence seq repeat forever {\n" +
@ -231,7 +231,7 @@ class DSLTemplateAnimationTest
" param duration type time min 1 max 10 default 5\n" + " param duration type time min 1 max 10 default 5\n" +
" param intensity type number min 0 max 255 default 200\n" + " param intensity type number min 0 max 255 default 200\n" +
" \n" + " \n" +
" color col = color_cycle(colors=colors, cycle_period=0)\n" + " color col = color_cycle(colors=colors, period=0)\n" +
" animation test = solid(color=col)\n" + " animation test = solid(color=col)\n" +
" test.opacity = intensity\n" + " test.opacity = intensity\n" +
" run test\n" + " run test\n" +
@ -294,7 +294,7 @@ class DSLTemplateAnimationTest
" param colors type palette\n" + " param colors type palette\n" +
" param duration type time\n" + " param duration type time\n" +
" \n" + " \n" +
" color col = color_cycle(colors=colors, cycle_period=0)\n" + " color col = color_cycle(colors=colors, period=0)\n" +
" animation test = solid(color=col)\n" + " animation test = solid(color=col)\n" +
" \n" + " \n" +
" sequence seq repeat forever {\n" + " sequence seq repeat forever {\n" +
@ -474,7 +474,7 @@ class DSLTemplateAnimationTest
" set strip_len = strip_length()\n" + " set strip_len = strip_length()\n" +
" set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" + " set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" +
" \n" + " \n" +
" color col = color_cycle(colors=colors, cycle_period=0)\n" + " color col = color_cycle(colors=colors, period=0)\n" +
" animation test = beacon_animation(color=col, beacon_size=shutter_size)\n" + " animation test = beacon_animation(color=col, beacon_size=shutter_size)\n" +
" \n" + " \n" +
" sequence seq repeat forever {\n" + " sequence seq repeat forever {\n" +
@ -546,8 +546,8 @@ class DSLTemplateAnimationTest
" set strip_len2 = (strip_len + 1) / 2\n" + " set strip_len2 = (strip_len + 1) / 2\n" +
" set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" + " set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" +
" \n" + " \n" +
" color col1 = color_cycle(colors=colors, cycle_period=0)\n" + " color col1 = color_cycle(colors=colors, period=0)\n" +
" color col2 = color_cycle(colors=colors, cycle_period=0)\n" + " color col2 = color_cycle(colors=colors, period=0)\n" +
" col2.next = 1\n" + " col2.next = 1\n" +
" \n" + " \n" +
" animation shutter = beacon_animation(\n" + " animation shutter = beacon_animation(\n" +

View File

@ -262,7 +262,7 @@ print(repeat_berry_code)
# Test complex cylon rainbow example # Test complex cylon rainbow example
var cylon_dsl = "set strip_len = strip_length()\n" + var cylon_dsl = "set strip_len = strip_length()\n" +
"palette eye_palette = [ red, yellow, green, violet ]\n" + "palette eye_palette = [ red, yellow, green, violet ]\n" +
"color eye_color = color_cycle(colors=eye_palette, cycle_period=0)\n" + "color eye_color = color_cycle(colors=eye_palette, period=0)\n" +
"set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" + "set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
"set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" + "set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
"\n" + "\n" +

View File

@ -119,7 +119,7 @@ class DSLValueProviderValidationTest
def test_nested_value_providers() def test_nested_value_providers()
var dsl_code = var dsl_code =
"# strip length 30 # TEMPORARILY DISABLED\n" "# strip length 30 # TEMPORARILY DISABLED\n"
"animation test = pulsating_animation(color=color_cycle(colors=[0xFF0000FF, 0xFF00FF00], cycle_period=oscillator_value(min_value=1000, bad_param=456)))\n" "animation test = pulsating_animation(color=color_cycle(colors=[0xFF0000FF, 0xFF00FF00], period=oscillator_value(min_value=1000, bad_param=456)))\n"
"run test" "run test"
var compilation_failed = false var compilation_failed = false

View File

@ -58,7 +58,7 @@ assert(pixel_color == 0xFF0000FF, f"Expected 0xFF0000FF, got {pixel_color:08X}")
print("Test 2: animation.solid with a color cycle provider") print("Test 2: animation.solid with a color cycle provider")
var cycle_provider = animation.color_cycle(mock_engine) var cycle_provider = animation.color_cycle(mock_engine)
cycle_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # BGR colors in AARRGGBB format cycle_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # BGR colors in AARRGGBB format
cycle_provider.cycle_period = 1000 # 1 second cycle period cycle_provider.period = 1000 # 1 second cycle period
# Note: transition_type removed - now uses "brutal" color switching # Note: transition_type removed - now uses "brutal" color switching
var cycle_anim = animation.solid(mock_engine) var cycle_anim = animation.solid(mock_engine)
@ -83,7 +83,7 @@ assert(result, "Render should return true")
print("Test 3: animation.solid with a rich palette provider") print("Test 3: animation.solid with a rich palette provider")
var rich_provider = animation.rich_palette(mock_engine) var rich_provider = animation.rich_palette(mock_engine)
rich_provider.colors = animation.PALETTE_RAINBOW # Use the rainbow palette rich_provider.colors = animation.PALETTE_RAINBOW # Use the rainbow palette
rich_provider.cycle_period = 1000 # 1 second cycle period rich_provider.period = 1000 # 1 second cycle period
# Note: transition_type removed - rich palette uses smooth transitions # Note: transition_type removed - rich palette uses smooth transitions
rich_provider.brightness = 255 # Full brightness rich_provider.brightness = 255 # Full brightness
@ -109,7 +109,7 @@ assert(result, "Render should return true")
print("Test 4: animation.solid with a composite provider") print("Test 4: animation.solid with a composite provider")
var rich_provider2 = animation.rich_palette(mock_engine) var rich_provider2 = animation.rich_palette(mock_engine)
rich_provider2.colors = animation.PALETTE_RAINBOW rich_provider2.colors = animation.PALETTE_RAINBOW
rich_provider2.cycle_period = 1000 rich_provider2.period = 1000
# Note: transition_type removed # Note: transition_type removed
rich_provider2.brightness = 255 rich_provider2.brightness = 255

View File

@ -112,7 +112,7 @@ print("Set to solid red color")
# Set back to fire palette # Set back to fire palette
var fire_palette = animation.rich_palette(engine) var fire_palette = animation.rich_palette(engine)
fire_palette.colors = animation.PALETTE_FIRE fire_palette.colors = animation.PALETTE_FIRE
fire_palette.cycle_period = 5000 fire_palette.period = 5000
fire_palette.transition_type = 1 # Use sine transition (smooth) fire_palette.transition_type = 1 # Use sine transition (smooth)
fire_palette.brightness = 255 fire_palette.brightness = 255
fire.color = fire_palette fire.color = fire_palette

Some files were not shown because too many files have changed in this diff Show More