Berry animation rename palette to colors (#24259)
This commit is contained in:
parent
46b9823af4
commit
f82cbeb2aa
@ -22,7 +22,7 @@ palette breathe_palette = [
|
||||
|
||||
# Create a rich palette color provider
|
||||
color palette_pattern = rich_palette(
|
||||
palette=breathe_palette # palette
|
||||
colors=breathe_palette # palette
|
||||
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
)
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ palette ornament_colors = [
|
||||
]
|
||||
|
||||
# Colorful ornaments as twinkling lights
|
||||
color ornament_pattern = rich_palette(palette=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation ornaments = twinkle_animation(
|
||||
color=ornament_pattern # color source
|
||||
density=15 # density (many ornaments)
|
||||
@ -44,7 +44,7 @@ animation snow_sparkles = twinkle_animation(
|
||||
snow_sparkles.priority = 15
|
||||
|
||||
# Garland effect - moving colored lights
|
||||
color garland_pattern = rich_palette(palette=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
color garland_pattern = rich_palette(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
animation garland = comet_animation(
|
||||
color=garland_pattern # color source
|
||||
tail_length=6 # garland length (tail length)
|
||||
|
||||
@ -29,7 +29,7 @@ var breathe_palette_ = bytes(
|
||||
)
|
||||
# Create a rich palette color provider
|
||||
var palette_pattern_ = animation.rich_palette(engine)
|
||||
palette_pattern_.palette = breathe_palette_ # palette
|
||||
palette_pattern_.colors = breathe_palette_ # palette
|
||||
palette_pattern_.cycle_period = 15000 # cycle period (defaults: smooth transition, 255 brightness)
|
||||
# Create breathing animation using the palette
|
||||
var breathing_ = animation.breathe_animation(engine)
|
||||
@ -75,7 +75,7 @@ palette breathe_palette = [
|
||||
|
||||
# Create a rich palette color provider
|
||||
color palette_pattern = rich_palette(
|
||||
palette=breathe_palette # palette
|
||||
colors=breathe_palette # palette
|
||||
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
)
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ var ornament_colors_ = bytes(
|
||||
)
|
||||
# Colorful ornaments as twinkling lights
|
||||
var ornament_pattern_ = animation.rich_palette(engine)
|
||||
ornament_pattern_.palette = ornament_colors_
|
||||
ornament_pattern_.colors = ornament_colors_
|
||||
ornament_pattern_.cycle_period = 3000
|
||||
ornament_pattern_.transition_type = animation.LINEAR
|
||||
ornament_pattern_.brightness = 255
|
||||
@ -57,7 +57,7 @@ snow_sparkles_.twinkle_speed = 400 # twinkle speed (quick sparkles)
|
||||
snow_sparkles_.priority = 15
|
||||
# Garland effect - moving colored lights
|
||||
var garland_pattern_ = animation.rich_palette(engine)
|
||||
garland_pattern_.palette = ornament_colors_
|
||||
garland_pattern_.colors = ornament_colors_
|
||||
garland_pattern_.cycle_period = 2000
|
||||
garland_pattern_.transition_type = animation.LINEAR
|
||||
garland_pattern_.brightness = 200
|
||||
@ -95,7 +95,7 @@ palette ornament_colors = [
|
||||
]
|
||||
|
||||
# Colorful ornaments as twinkling lights
|
||||
color ornament_pattern = rich_palette(palette=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation ornaments = twinkle_animation(
|
||||
color=ornament_pattern # color source
|
||||
density=15 # density (many ornaments)
|
||||
@ -122,7 +122,7 @@ animation snow_sparkles = twinkle_animation(
|
||||
snow_sparkles.priority = 15
|
||||
|
||||
# Garland effect - moving colored lights
|
||||
color garland_pattern = rich_palette(palette=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
color garland_pattern = rich_palette(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
animation garland = comet_animation(
|
||||
color=garland_pattern # color source
|
||||
tail_length=6 # garland length (tail length)
|
||||
|
||||
@ -15,7 +15,7 @@ var strip_len_ = animation.strip_length(engine)
|
||||
var eye_duration_ = 5000 # duration for a cylon eye cycle
|
||||
var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE")
|
||||
var eye_color_ = animation.color_cycle(engine)
|
||||
eye_color_.palette = eye_palette_
|
||||
eye_color_.colors = eye_palette_
|
||||
eye_color_.cycle_period = 0
|
||||
var cosine_val_ = (def (engine)
|
||||
var provider = animation.cosine_osc(engine)
|
||||
@ -58,7 +58,7 @@ set eye_duration = 5s # duration for a cylon eye cycle
|
||||
|
||||
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, cycle_period=0)
|
||||
|
||||
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)
|
||||
|
||||
@ -19,7 +19,7 @@ var fire_colors_ = bytes(
|
||||
)
|
||||
var strip_len_ = animation.strip_length(engine)
|
||||
var fire_color_ = animation.rich_palette(engine)
|
||||
fire_color_.palette = fire_colors_
|
||||
fire_color_.colors = fire_colors_
|
||||
var background_ = animation.solid(engine)
|
||||
background_.color = 0xFF000088
|
||||
background_.priority = 20
|
||||
@ -58,7 +58,7 @@ palette fire_colors = [
|
||||
]
|
||||
|
||||
set strip_len = strip_length()
|
||||
color fire_color = rich_palette(palette=fire_colors)
|
||||
color fire_color = rich_palette(colors=fire_colors)
|
||||
|
||||
animation background = solid(color=0x000088, priority=20)
|
||||
run background
|
||||
|
||||
@ -22,10 +22,10 @@ var shutter_size_ = (def (engine)
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = animation.PALETTE_RAINBOW
|
||||
col1_.colors = animation.PALETTE_RAINBOW
|
||||
col1_.cycle_period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = animation.PALETTE_RAINBOW
|
||||
col2_.colors = animation.PALETTE_RAINBOW
|
||||
col2_.cycle_period = 0
|
||||
col2_.next = 1
|
||||
var shutter_animation_ = animation.beacon_animation(engine)
|
||||
@ -57,8 +57,8 @@ set duration = 3s
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
|
||||
|
||||
color col1 = color_cycle(palette=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(palette=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
animation shutter_animation = beacon_animation(
|
||||
|
||||
@ -29,10 +29,10 @@ class shutter_bidir_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving from left to right
|
||||
@ -100,8 +100,8 @@ template animation shutter_bidir {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving in to out
|
||||
@ -101,8 +101,8 @@ template animation shutter_central {
|
||||
set strip_len2 = (strip_len + 1) / 2
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -29,10 +29,10 @@ class shutter_lr_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving from left to right
|
||||
@ -83,8 +83,8 @@ template animation shutter_lr {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -24,7 +24,7 @@ var disco_colors_ = bytes(
|
||||
)
|
||||
# Fast color cycling base
|
||||
var disco_rich_color_ = animation.rich_palette(engine)
|
||||
disco_rich_color_.palette = disco_colors_
|
||||
disco_rich_color_.colors = disco_colors_
|
||||
disco_rich_color_.cycle_period = 1000
|
||||
disco_rich_color_.transition_type = animation.LINEAR
|
||||
disco_rich_color_.brightness = 255
|
||||
@ -53,7 +53,7 @@ end)(engine) # Quick white flashes
|
||||
white_flash_.priority = 20
|
||||
# Add colored sparkles
|
||||
var sparkle_pattern_ = animation.rich_palette(engine)
|
||||
sparkle_pattern_.palette = disco_colors_
|
||||
sparkle_pattern_.colors = disco_colors_
|
||||
sparkle_pattern_.cycle_period = 500
|
||||
sparkle_pattern_.transition_type = animation.LINEAR
|
||||
sparkle_pattern_.brightness = 255
|
||||
@ -64,7 +64,7 @@ disco_sparkles_.twinkle_speed = 80 # twinkle speed (very quick)
|
||||
disco_sparkles_.priority = 15
|
||||
# Add moving pulse for extra effect
|
||||
var pulse_pattern_ = animation.rich_palette(engine)
|
||||
pulse_pattern_.palette = disco_colors_
|
||||
pulse_pattern_.colors = disco_colors_
|
||||
pulse_pattern_.cycle_period = 800
|
||||
pulse_pattern_.transition_type = animation.LINEAR
|
||||
pulse_pattern_.brightness = 255
|
||||
@ -107,7 +107,7 @@ palette disco_colors = [
|
||||
]
|
||||
|
||||
# Fast color cycling base
|
||||
color disco_rich_color = rich_palette(palette=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
color disco_rich_color = rich_palette(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
animation disco_base = solid(color=disco_rich_color)
|
||||
|
||||
# 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
|
||||
|
||||
# Add colored sparkles
|
||||
color sparkle_pattern = rich_palette(palette=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
color sparkle_pattern = rich_palette(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_sparkles = twinkle_animation(
|
||||
color=sparkle_pattern # color source
|
||||
density=12 # density (many sparkles)
|
||||
@ -128,7 +128,7 @@ animation disco_sparkles = twinkle_animation(
|
||||
disco_sparkles.priority = 15
|
||||
|
||||
# Add moving pulse for extra effect
|
||||
color pulse_pattern = rich_palette(palette=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
color pulse_pattern = rich_palette(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_pulse = beacon_animation(
|
||||
color=pulse_pattern # color source
|
||||
pos=4 # initial position
|
||||
|
||||
@ -22,7 +22,7 @@ var fire_colors_ = bytes(
|
||||
)
|
||||
# Create base fire animation with palette
|
||||
var fire_base_color_ = animation.rich_palette(engine)
|
||||
fire_base_color_.palette = fire_colors_
|
||||
fire_base_color_.colors = fire_colors_
|
||||
fire_base_color_.cycle_period = 3000
|
||||
fire_base_color_.transition_type = animation.LINEAR
|
||||
fire_base_color_.brightness = 255
|
||||
@ -38,7 +38,7 @@ fire_base_.opacity = (def (engine)
|
||||
end)(engine)
|
||||
# Add subtle position variation for more realism
|
||||
var flicker_pattern_ = animation.rich_palette(engine)
|
||||
flicker_pattern_.palette = fire_colors_
|
||||
flicker_pattern_.colors = fire_colors_
|
||||
flicker_pattern_.cycle_period = 2000
|
||||
flicker_pattern_.transition_type = animation.LINEAR
|
||||
flicker_pattern_.brightness = 255
|
||||
@ -69,14 +69,14 @@ palette fire_colors = [
|
||||
]
|
||||
|
||||
# Create base fire animation with palette
|
||||
color fire_base_color = rich_palette(palette=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_base = solid(color=fire_base_color)
|
||||
|
||||
# Add flickering effect with random intensity changes
|
||||
fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
|
||||
|
||||
# Add subtle position variation for more realism
|
||||
color flicker_pattern = rich_palette(palette=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color flicker_pattern = rich_palette(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_flicker = twinkle_animation(
|
||||
color=flicker_pattern # color source
|
||||
density=12 # density (number of flickers)
|
||||
|
||||
@ -22,13 +22,13 @@ var lava_colors_ = bytes(
|
||||
)
|
||||
# Base lava animation - very slow color changes
|
||||
var lava_base_ = animation.rich_palette_animation(engine)
|
||||
lava_base_.palette = lava_colors_
|
||||
lava_base_.colors = lava_colors_
|
||||
lava_base_.cycle_period = 15000
|
||||
lava_base_.transition_type = animation.SINE
|
||||
lava_base_.brightness = 180
|
||||
# Add slow-moving lava blobs
|
||||
var blob1_pattern_ = animation.rich_palette(engine)
|
||||
blob1_pattern_.palette = lava_colors_
|
||||
blob1_pattern_.colors = lava_colors_
|
||||
blob1_pattern_.cycle_period = 12000
|
||||
blob1_pattern_.transition_type = animation.SINE
|
||||
blob1_pattern_.brightness = 255
|
||||
@ -46,7 +46,7 @@ lava_blob1_.pos = (def (engine)
|
||||
return provider
|
||||
end)(engine) # Very slow movement
|
||||
var blob2_pattern_ = animation.rich_palette(engine)
|
||||
blob2_pattern_.palette = lava_colors_
|
||||
blob2_pattern_.colors = lava_colors_
|
||||
blob2_pattern_.cycle_period = 10000
|
||||
blob2_pattern_.transition_type = animation.SINE
|
||||
blob2_pattern_.brightness = 220
|
||||
@ -64,7 +64,7 @@ lava_blob2_.pos = (def (engine)
|
||||
return provider
|
||||
end)(engine) # Opposite direction, slower
|
||||
var blob3_pattern_ = animation.rich_palette(engine)
|
||||
blob3_pattern_.palette = lava_colors_
|
||||
blob3_pattern_.colors = lava_colors_
|
||||
blob3_pattern_.cycle_period = 8000
|
||||
blob3_pattern_.transition_type = animation.SINE
|
||||
blob3_pattern_.brightness = 200
|
||||
@ -83,7 +83,7 @@ lava_blob3_.pos = (def (engine)
|
||||
end)(engine) # Small movement range
|
||||
# Add subtle heat shimmer effect
|
||||
var shimmer_pattern_ = animation.rich_palette(engine)
|
||||
shimmer_pattern_.palette = lava_colors_
|
||||
shimmer_pattern_.colors = lava_colors_
|
||||
shimmer_pattern_.cycle_period = 6000
|
||||
shimmer_pattern_.transition_type = animation.SINE
|
||||
shimmer_pattern_.brightness = 255
|
||||
@ -117,10 +117,10 @@ palette lava_colors = [
|
||||
]
|
||||
|
||||
# Base lava animation - very slow color changes
|
||||
animation lava_base = rich_palette_animation(palette=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
animation lava_base = rich_palette_animation(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
|
||||
# Add slow-moving lava blobs
|
||||
color blob1_pattern = rich_palette(palette=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
animation lava_blob1 = beacon_animation(
|
||||
color=blob1_pattern # color source
|
||||
pos=9 # initial position
|
||||
@ -130,7 +130,7 @@ animation lava_blob1 = beacon_animation(
|
||||
lava_blob1.priority = 10
|
||||
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
|
||||
|
||||
color blob2_pattern = rich_palette(palette=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
color blob2_pattern = rich_palette(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
animation lava_blob2 = beacon_animation(
|
||||
color=blob2_pattern # color source
|
||||
pos=46 # initial position
|
||||
@ -140,7 +140,7 @@ animation lava_blob2 = beacon_animation(
|
||||
lava_blob2.priority = 8
|
||||
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
|
||||
|
||||
color blob3_pattern = rich_palette(palette=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
color blob3_pattern = rich_palette(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation lava_blob3 = beacon_animation(
|
||||
color=blob3_pattern # color source
|
||||
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
|
||||
|
||||
# Add subtle heat shimmer effect
|
||||
color shimmer_pattern = rich_palette(palette=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color shimmer_pattern = rich_palette(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
animation heat_shimmer = twinkle_animation(
|
||||
color=shimmer_pattern # color source
|
||||
density=6 # density (shimmer points)
|
||||
|
||||
@ -19,7 +19,7 @@ var storm_colors_ = bytes(
|
||||
"FF220033" # Slightly lighter purple
|
||||
)
|
||||
var storm_bg_ = animation.rich_palette_animation(engine)
|
||||
storm_bg_.palette = storm_colors_
|
||||
storm_bg_.colors = storm_colors_
|
||||
storm_bg_.cycle_period = 12000
|
||||
storm_bg_.transition_type = animation.SINE
|
||||
storm_bg_.brightness = 100
|
||||
@ -92,7 +92,7 @@ palette storm_colors = [
|
||||
(255, 0x220033) # Slightly lighter purple
|
||||
]
|
||||
|
||||
animation storm_bg = rich_palette_animation(palette=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
animation storm_bg = rich_palette_animation(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
|
||||
# Random lightning flashes - full strip
|
||||
animation lightning_main = solid(color=0xFFFFFF) # Bright white
|
||||
|
||||
@ -27,7 +27,7 @@ var matrix_greens_ = bytes(
|
||||
)
|
||||
# Create multiple cascading streams
|
||||
var stream1_pattern_ = animation.rich_palette(engine)
|
||||
stream1_pattern_.palette = matrix_greens_
|
||||
stream1_pattern_.colors = matrix_greens_
|
||||
stream1_pattern_.cycle_period = 2000
|
||||
stream1_pattern_.transition_type = animation.LINEAR
|
||||
stream1_pattern_.brightness = 255
|
||||
@ -37,7 +37,7 @@ stream1_.tail_length = 15 # long tail
|
||||
stream1_.speed = 1500 # speed
|
||||
stream1_.priority = 10
|
||||
var stream2_pattern_ = animation.rich_palette(engine)
|
||||
stream2_pattern_.palette = matrix_greens_
|
||||
stream2_pattern_.colors = matrix_greens_
|
||||
stream2_pattern_.cycle_period = 1800
|
||||
stream2_pattern_.transition_type = animation.LINEAR
|
||||
stream2_pattern_.brightness = 200
|
||||
@ -47,7 +47,7 @@ stream2_.tail_length = 12 # medium tail
|
||||
stream2_.speed = 2200 # different speed
|
||||
stream2_.priority = 8
|
||||
var stream3_pattern_ = animation.rich_palette(engine)
|
||||
stream3_pattern_.palette = matrix_greens_
|
||||
stream3_pattern_.colors = matrix_greens_
|
||||
stream3_pattern_.cycle_period = 2500
|
||||
stream3_pattern_.transition_type = animation.LINEAR
|
||||
stream3_pattern_.brightness = 180
|
||||
@ -91,7 +91,7 @@ palette matrix_greens = [
|
||||
]
|
||||
|
||||
# Create multiple cascading streams
|
||||
color stream1_pattern = rich_palette(palette=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation stream1 = comet_animation(
|
||||
color=stream1_pattern # color source
|
||||
tail_length=15 # long tail
|
||||
@ -100,7 +100,7 @@ animation stream1 = comet_animation(
|
||||
)
|
||||
|
||||
|
||||
color stream2_pattern = rich_palette(palette=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
animation stream2 = comet_animation(
|
||||
color=stream2_pattern # color source
|
||||
tail_length=12 # medium tail
|
||||
@ -108,7 +108,7 @@ animation stream2 = comet_animation(
|
||||
priority = 8
|
||||
)
|
||||
|
||||
color stream3_pattern = rich_palette(palette=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
color stream3_pattern = rich_palette(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
animation stream3 = comet_animation(
|
||||
color=stream3_pattern # color source
|
||||
tail_length=10 # shorter tail
|
||||
|
||||
@ -21,7 +21,7 @@ var neon_colors_ = bytes(
|
||||
)
|
||||
# Main neon glow with color cycling
|
||||
var neon_main_ = animation.rich_palette_animation(engine)
|
||||
neon_main_.palette = neon_colors_
|
||||
neon_main_.colors = neon_colors_
|
||||
neon_main_.cycle_period = 4000
|
||||
neon_main_.transition_type = animation.LINEAR
|
||||
neon_main_.brightness = 255
|
||||
@ -48,7 +48,7 @@ end)(engine) # Quick bright surges
|
||||
neon_surge_.priority = 20
|
||||
# Add neon tube segments with gaps
|
||||
var segment_pattern_ = animation.rich_palette(engine)
|
||||
segment_pattern_.palette = neon_colors_
|
||||
segment_pattern_.colors = neon_colors_
|
||||
segment_pattern_.cycle_period = 4000
|
||||
segment_pattern_.transition_type = animation.LINEAR
|
||||
segment_pattern_.brightness = 255
|
||||
@ -101,7 +101,7 @@ palette neon_colors = [
|
||||
]
|
||||
|
||||
# Main neon glow with color cycling
|
||||
animation neon_main = rich_palette_animation(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation neon_main = rich_palette_animation(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
|
||||
# Add electrical flickering
|
||||
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
|
||||
|
||||
# Add neon tube segments with gaps
|
||||
color segment_pattern = rich_palette(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
color segment_pattern = rich_palette(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation segment1 = beacon_animation(
|
||||
color=segment_pattern # color source
|
||||
pos=6 # position
|
||||
|
||||
@ -22,13 +22,13 @@ var ocean_colors_ = bytes(
|
||||
)
|
||||
# Base ocean animation with slow color cycling
|
||||
var ocean_base_ = animation.rich_palette_animation(engine)
|
||||
ocean_base_.palette = ocean_colors_
|
||||
ocean_base_.colors = ocean_colors_
|
||||
ocean_base_.cycle_period = 8000
|
||||
ocean_base_.transition_type = animation.SINE
|
||||
ocean_base_.brightness = 200
|
||||
# Add wave motion with moving pulses
|
||||
var wave1_pattern_ = animation.rich_palette(engine)
|
||||
wave1_pattern_.palette = ocean_colors_
|
||||
wave1_pattern_.colors = ocean_colors_
|
||||
wave1_pattern_.cycle_period = 6000
|
||||
wave1_pattern_.transition_type = animation.SINE
|
||||
wave1_pattern_.brightness = 255
|
||||
@ -46,7 +46,7 @@ wave1_.pos = (def (engine)
|
||||
return provider
|
||||
end)(engine) # 60-12 = 48
|
||||
var wave2_pattern_ = animation.rich_palette(engine)
|
||||
wave2_pattern_.palette = ocean_colors_
|
||||
wave2_pattern_.colors = ocean_colors_
|
||||
wave2_pattern_.cycle_period = 4000
|
||||
wave2_pattern_.transition_type = animation.SINE
|
||||
wave2_pattern_.brightness = 180
|
||||
@ -93,10 +93,10 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Base ocean animation with slow color cycling
|
||||
animation ocean_base = rich_palette_animation(palette=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add wave motion with moving pulses
|
||||
color wave1_pattern = rich_palette(palette=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
animation wave1 = beacon_animation(
|
||||
color=wave1_pattern # color source
|
||||
pos=0 # initial position
|
||||
@ -106,7 +106,7 @@ animation wave1 = beacon_animation(
|
||||
wave1.priority = 10
|
||||
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
|
||||
|
||||
color wave2_pattern = rich_palette(palette=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
animation wave2 = beacon_animation(
|
||||
color=wave2_pattern # color source
|
||||
pos=52 # initial position
|
||||
|
||||
@ -24,10 +24,10 @@ var ocean_colors_ = bytes(
|
||||
)
|
||||
# Create animations using the palettes
|
||||
var fire_anim_ = animation.rich_palette_animation(engine)
|
||||
fire_anim_.palette = fire_colors_
|
||||
fire_anim_.colors = fire_colors_
|
||||
fire_anim_.cycle_period = 5000
|
||||
var ocean_anim_ = animation.rich_palette_animation(engine)
|
||||
ocean_anim_.palette = ocean_colors_
|
||||
ocean_anim_.colors = ocean_colors_
|
||||
ocean_anim_.cycle_period = 8000
|
||||
# Sequence to show both palettes
|
||||
var palette_demo_ = animation.sequence_manager(engine)
|
||||
@ -62,9 +62,9 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Create animations using the palettes
|
||||
animation fire_anim = rich_palette_animation(palette=fire_colors, cycle_period=5s)
|
||||
animation fire_anim = rich_palette_animation(colors=fire_colors, cycle_period=5s)
|
||||
|
||||
animation ocean_anim = rich_palette_animation(palette=ocean_colors, cycle_period=8s)
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s)
|
||||
|
||||
# Sequence to show both palettes
|
||||
sequence palette_demo {
|
||||
|
||||
@ -52,22 +52,22 @@ var sunset_sky_ = bytes(
|
||||
var fire_effect_ = animation.solid(engine)
|
||||
fire_effect_.color = (def (engine)
|
||||
var provider = animation.rich_palette(engine)
|
||||
provider.palette = fire_gradient_
|
||||
provider.colors = fire_gradient_
|
||||
provider.cycle_period = 3000
|
||||
return provider
|
||||
end)(engine)
|
||||
var ocean_waves_ = animation.rich_palette_animation(engine)
|
||||
ocean_waves_.palette = ocean_depths_
|
||||
ocean_waves_.colors = ocean_depths_
|
||||
ocean_waves_.cycle_period = 8000
|
||||
ocean_waves_.transition_type = animation.SINE
|
||||
ocean_waves_.brightness = 200
|
||||
var aurora_lights_ = animation.rich_palette_animation(engine)
|
||||
aurora_lights_.palette = aurora_borealis_
|
||||
aurora_lights_.colors = aurora_borealis_
|
||||
aurora_lights_.cycle_period = 12000
|
||||
aurora_lights_.transition_type = animation.SINE
|
||||
aurora_lights_.brightness = 180
|
||||
var sunset_glow_ = animation.rich_palette_animation(engine)
|
||||
sunset_glow_.palette = sunset_sky_
|
||||
sunset_glow_.colors = sunset_sky_
|
||||
sunset_glow_.cycle_period = 6000
|
||||
sunset_glow_.transition_type = animation.SINE
|
||||
sunset_glow_.brightness = 220
|
||||
@ -143,13 +143,13 @@ palette sunset_sky = [
|
||||
]
|
||||
|
||||
# Create animations using each palette
|
||||
animation fire_effect = solid(color=rich_palette(palette=fire_gradient, cycle_period=3s))
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s))
|
||||
|
||||
animation ocean_waves = rich_palette_animation(palette=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
animation aurora_lights = rich_palette_animation(palette=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
|
||||
animation sunset_glow = rich_palette_animation(palette=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
|
||||
# Sequence to showcase all palettes
|
||||
sequence palette_showcase {
|
||||
|
||||
@ -23,13 +23,13 @@ var plasma_colors_ = bytes(
|
||||
)
|
||||
# Base plasma animation with medium speed
|
||||
var plasma_base_ = animation.rich_palette_animation(engine)
|
||||
plasma_base_.palette = plasma_colors_
|
||||
plasma_base_.colors = plasma_colors_
|
||||
plasma_base_.cycle_period = 6000
|
||||
plasma_base_.transition_type = animation.SINE
|
||||
plasma_base_.brightness = 200
|
||||
# Add multiple wave layers for complexity
|
||||
var wave1_pattern_ = animation.rich_palette(engine)
|
||||
wave1_pattern_.palette = plasma_colors_
|
||||
wave1_pattern_.colors = plasma_colors_
|
||||
wave1_pattern_.cycle_period = 4000
|
||||
wave1_pattern_.transition_type = animation.SINE
|
||||
wave1_pattern_.brightness = 255
|
||||
@ -47,7 +47,7 @@ plasma_wave1_.pos = (def (engine)
|
||||
return provider
|
||||
end)(engine)
|
||||
var wave2_pattern_ = animation.rich_palette(engine)
|
||||
wave2_pattern_.palette = plasma_colors_
|
||||
wave2_pattern_.colors = plasma_colors_
|
||||
wave2_pattern_.cycle_period = 5000
|
||||
wave2_pattern_.transition_type = animation.SINE
|
||||
wave2_pattern_.brightness = 180
|
||||
@ -65,7 +65,7 @@ plasma_wave2_.pos = (def (engine)
|
||||
return provider
|
||||
end)(engine) # Opposite direction
|
||||
var wave3_pattern_ = animation.rich_palette(engine)
|
||||
wave3_pattern_.palette = plasma_colors_
|
||||
wave3_pattern_.colors = plasma_colors_
|
||||
wave3_pattern_.cycle_period = 3000
|
||||
wave3_pattern_.transition_type = animation.SINE
|
||||
wave3_pattern_.brightness = 220
|
||||
@ -115,10 +115,10 @@ palette plasma_colors = [
|
||||
]
|
||||
|
||||
# Base plasma animation with medium speed
|
||||
animation plasma_base = rich_palette_animation(palette=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add multiple wave layers for complexity
|
||||
color wave1_pattern = rich_palette(palette=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
animation plasma_wave1 = beacon_animation(
|
||||
color=wave1_pattern # color source
|
||||
pos=0 # initial position
|
||||
@ -128,7 +128,7 @@ animation plasma_wave1 = beacon_animation(
|
||||
plasma_wave1.priority = 10
|
||||
plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s)
|
||||
|
||||
color wave2_pattern = rich_palette(palette=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
animation plasma_wave2 = beacon_animation(
|
||||
color=wave2_pattern # color source
|
||||
pos=45 # initial position
|
||||
@ -138,7 +138,7 @@ animation plasma_wave2 = beacon_animation(
|
||||
plasma_wave2.priority = 8
|
||||
plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction
|
||||
|
||||
color wave3_pattern = rich_palette(palette=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
color wave3_pattern = rich_palette(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
animation plasma_wave3 = beacon_animation(
|
||||
color=wave3_pattern # color source
|
||||
pos=20 # initial position
|
||||
|
||||
@ -15,7 +15,7 @@ var engine = animation.init_strip()
|
||||
var rainbow_palette_ = bytes("FFFF0000" "FFFF8000" "FFFFFF00" "FF00FF00" "FF0000FF" "FF8000FF" "FFFF00FF") # rainbow colors
|
||||
# Create smooth rainbow cycle animation
|
||||
var rainbow_cycle_ = animation.color_cycle(engine)
|
||||
rainbow_cycle_.palette = rainbow_palette_
|
||||
rainbow_cycle_.colors = rainbow_palette_
|
||||
rainbow_cycle_.cycle_period = 5000 # cycle period
|
||||
var rainbow_animation_ = animation.solid(engine)
|
||||
rainbow_animation_.color = rainbow_cycle_
|
||||
@ -34,7 +34,7 @@ palette rainbow_palette = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8
|
||||
|
||||
# Create smooth rainbow cycle animation
|
||||
color rainbow_cycle = color_cycle(
|
||||
palette=rainbow_palette
|
||||
colors=rainbow_palette
|
||||
cycle_period=5s # cycle period
|
||||
)
|
||||
animation rainbow_animation = solid(color=rainbow_cycle)
|
||||
|
||||
@ -32,7 +32,7 @@ var brightness_low_ = 64
|
||||
# Create color palette and cycling color
|
||||
var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE")
|
||||
var eye_color_ = animation.color_cycle(engine)
|
||||
eye_color_.palette = eye_palette_
|
||||
eye_color_.colors = eye_palette_
|
||||
eye_color_.cycle_period = 0
|
||||
# Create animations
|
||||
var red_eye_ = animation.beacon_animation(engine)
|
||||
@ -126,7 +126,7 @@ set brightness_low = 64
|
||||
|
||||
# Create color palette and cycling color
|
||||
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, cycle_period=0)
|
||||
|
||||
# Create animations
|
||||
animation red_eye = beacon_animation(
|
||||
|
||||
@ -16,7 +16,7 @@ var engine = animation.init_strip()
|
||||
var rainbow_ = bytes("00FF0000" "40FFA500" "80FFFF00" "C0008000" "FF0000FF")
|
||||
# Create an animation using the palette
|
||||
var rainbow_cycle_ = animation.rich_palette_animation(engine)
|
||||
rainbow_cycle_.palette = rainbow_
|
||||
rainbow_cycle_.colors = rainbow_
|
||||
rainbow_cycle_.cycle_period = 3000
|
||||
# Simple sequence
|
||||
var demo_ = animation.sequence_manager(engine)
|
||||
@ -41,7 +41,7 @@ palette rainbow = [
|
||||
]
|
||||
|
||||
# Create an animation using the palette
|
||||
animation rainbow_cycle = rich_palette_animation(palette=rainbow, cycle_period=3s)
|
||||
animation rainbow_cycle = rich_palette_animation(colors=rainbow, cycle_period=3s)
|
||||
|
||||
# Simple sequence
|
||||
sequence demo {
|
||||
|
||||
@ -26,7 +26,7 @@ var daylight_colors_ = bytes(
|
||||
)
|
||||
# Main daylight cycle - very slow transition
|
||||
var daylight_cycle_ = animation.rich_palette_animation(engine)
|
||||
daylight_cycle_.palette = daylight_colors_
|
||||
daylight_cycle_.colors = daylight_colors_
|
||||
daylight_cycle_.cycle_period = 60000
|
||||
# Add sun position effect - bright spot that moves
|
||||
var sun_position_ = animation.beacon_animation(engine)
|
||||
@ -111,7 +111,7 @@ palette daylight_colors = [
|
||||
]
|
||||
|
||||
# Main daylight cycle - very slow transition
|
||||
animation daylight_cycle = rich_palette_animation(palette=daylight_colors, cycle_period=60s)
|
||||
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, cycle_period=60s)
|
||||
|
||||
# Add sun position effect - bright spot that moves
|
||||
animation sun_position = beacon_animation(
|
||||
|
||||
@ -13,7 +13,7 @@ var engine = animation.init_strip()
|
||||
var strip_len_ = animation.strip_length(engine)
|
||||
var palette_olivary_ = bytes("FFFF0000" "FFFFA500" "FFFFFF00" "FF008000" "FF0000FF" "FF4B0082" "FFEE82EE" "FFFFFFFF")
|
||||
var olivary_ = animation.color_cycle(engine)
|
||||
olivary_.palette = palette_olivary_
|
||||
olivary_.colors = palette_olivary_
|
||||
olivary_.cycle_period = 0
|
||||
var swipe_animation_ = animation.solid(engine)
|
||||
swipe_animation_.color = olivary_
|
||||
@ -40,7 +40,7 @@ palette palette_olivary = [
|
||||
white
|
||||
]
|
||||
|
||||
color olivary = color_cycle(palette=palette_olivary, cycle_period=0)
|
||||
color olivary = color_cycle(colors=palette_olivary, cycle_period=0)
|
||||
|
||||
animation swipe_animation = solid(
|
||||
color = olivary
|
||||
|
||||
@ -21,7 +21,7 @@ class rainbow_pulse_animation : animation.engine_proxy
|
||||
var engine = self # using 'self' as a proxy to engine object (instead of 'self.engine')
|
||||
|
||||
var cycle_color_ = animation.color_cycle(engine)
|
||||
cycle_color_.palette = 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)
|
||||
# Create pulsing animation
|
||||
var pulse_ = animation.pulsating_animation(engine)
|
||||
@ -68,7 +68,7 @@ template animation rainbow_pulse {
|
||||
param back_color type color
|
||||
|
||||
# Create color cycle using first palette
|
||||
color cycle_color = color_cycle(palette=pal1, cycle_period=period)
|
||||
color cycle_color = color_cycle(colors=pal1, cycle_period=period)
|
||||
|
||||
# Create pulsing animation
|
||||
animation pulse = pulsating_animation(
|
||||
|
||||
@ -29,10 +29,10 @@ class shutter_bidir_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving from left to right
|
||||
@ -101,8 +101,8 @@ template animation shutter_bidir {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -29,10 +29,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving from left to right
|
||||
@ -83,8 +83,8 @@ template animation shutter_central {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -29,10 +29,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
return provider
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.palette = 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
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.palette = 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_.next = 1
|
||||
# shutter moving in to out
|
||||
@ -91,8 +91,8 @@ template animation shutter_central {
|
||||
set strip_len2 = (strip_len + 1) / 2
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -7,7 +7,7 @@ set eye_duration = 5s # duration for a cylon eye cycle
|
||||
|
||||
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, cycle_period=0)
|
||||
|
||||
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)
|
||||
|
||||
@ -9,7 +9,7 @@ palette fire_colors = [
|
||||
]
|
||||
|
||||
set strip_len = strip_length()
|
||||
color fire_color = rich_palette(palette=fire_colors)
|
||||
color fire_color = rich_palette(colors=fire_colors)
|
||||
|
||||
animation background = solid(color=0x000088, priority=20)
|
||||
run background
|
||||
|
||||
@ -7,8 +7,8 @@ set duration = 3s
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
|
||||
|
||||
color col1 = color_cycle(palette=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(palette=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
animation shutter_animation = beacon_animation(
|
||||
|
||||
@ -9,8 +9,8 @@ template animation shutter_bidir {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -10,8 +10,8 @@ template animation shutter_central {
|
||||
set strip_len2 = (strip_len + 1) / 2
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -9,8 +9,8 @@ template animation shutter_lr {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -15,7 +15,7 @@ palette disco_colors = [
|
||||
]
|
||||
|
||||
# Fast color cycling base
|
||||
color disco_rich_color = rich_palette(palette=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
color disco_rich_color = rich_palette(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
animation disco_base = solid(color=disco_rich_color)
|
||||
|
||||
# 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
|
||||
|
||||
# Add colored sparkles
|
||||
color sparkle_pattern = rich_palette(palette=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
color sparkle_pattern = rich_palette(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_sparkles = twinkle_animation(
|
||||
color=sparkle_pattern # color source
|
||||
density=12 # density (many sparkles)
|
||||
@ -36,7 +36,7 @@ animation disco_sparkles = twinkle_animation(
|
||||
disco_sparkles.priority = 15
|
||||
|
||||
# Add moving pulse for extra effect
|
||||
color pulse_pattern = rich_palette(palette=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
color pulse_pattern = rich_palette(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_pulse = beacon_animation(
|
||||
color=pulse_pattern # color source
|
||||
pos=4 # initial position
|
||||
|
||||
@ -13,14 +13,14 @@ palette fire_colors = [
|
||||
]
|
||||
|
||||
# Create base fire animation with palette
|
||||
color fire_base_color = rich_palette(palette=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_base = solid(color=fire_base_color)
|
||||
|
||||
# Add flickering effect with random intensity changes
|
||||
fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
|
||||
|
||||
# Add subtle position variation for more realism
|
||||
color flicker_pattern = rich_palette(palette=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color flicker_pattern = rich_palette(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_flicker = twinkle_animation(
|
||||
color=flicker_pattern # color source
|
||||
density=12 # density (number of flickers)
|
||||
|
||||
@ -13,10 +13,10 @@ palette lava_colors = [
|
||||
]
|
||||
|
||||
# Base lava animation - very slow color changes
|
||||
animation lava_base = rich_palette_animation(palette=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
animation lava_base = rich_palette_animation(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
|
||||
# Add slow-moving lava blobs
|
||||
color blob1_pattern = rich_palette(palette=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
animation lava_blob1 = beacon_animation(
|
||||
color=blob1_pattern # color source
|
||||
pos=9 # initial position
|
||||
@ -26,7 +26,7 @@ animation lava_blob1 = beacon_animation(
|
||||
lava_blob1.priority = 10
|
||||
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
|
||||
|
||||
color blob2_pattern = rich_palette(palette=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
color blob2_pattern = rich_palette(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
animation lava_blob2 = beacon_animation(
|
||||
color=blob2_pattern # color source
|
||||
pos=46 # initial position
|
||||
@ -36,7 +36,7 @@ animation lava_blob2 = beacon_animation(
|
||||
lava_blob2.priority = 8
|
||||
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
|
||||
|
||||
color blob3_pattern = rich_palette(palette=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
color blob3_pattern = rich_palette(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation lava_blob3 = beacon_animation(
|
||||
color=blob3_pattern # color source
|
||||
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
|
||||
|
||||
# Add subtle heat shimmer effect
|
||||
color shimmer_pattern = rich_palette(palette=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color shimmer_pattern = rich_palette(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
animation heat_shimmer = twinkle_animation(
|
||||
color=shimmer_pattern # color source
|
||||
density=6 # density (shimmer points)
|
||||
|
||||
@ -10,7 +10,7 @@ palette storm_colors = [
|
||||
(255, 0x220033) # Slightly lighter purple
|
||||
]
|
||||
|
||||
animation storm_bg = rich_palette_animation(palette=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
animation storm_bg = rich_palette_animation(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
|
||||
# Random lightning flashes - full strip
|
||||
animation lightning_main = solid(color=0xFFFFFF) # Bright white
|
||||
|
||||
@ -17,7 +17,7 @@ palette matrix_greens = [
|
||||
]
|
||||
|
||||
# Create multiple cascading streams
|
||||
color stream1_pattern = rich_palette(palette=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation stream1 = comet_animation(
|
||||
color=stream1_pattern # color source
|
||||
tail_length=15 # long tail
|
||||
@ -26,7 +26,7 @@ animation stream1 = comet_animation(
|
||||
)
|
||||
|
||||
|
||||
color stream2_pattern = rich_palette(palette=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
animation stream2 = comet_animation(
|
||||
color=stream2_pattern # color source
|
||||
tail_length=12 # medium tail
|
||||
@ -34,7 +34,7 @@ animation stream2 = comet_animation(
|
||||
priority = 8
|
||||
)
|
||||
|
||||
color stream3_pattern = rich_palette(palette=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
color stream3_pattern = rich_palette(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
animation stream3 = comet_animation(
|
||||
color=stream3_pattern # color source
|
||||
tail_length=10 # shorter tail
|
||||
|
||||
@ -12,7 +12,7 @@ palette neon_colors = [
|
||||
]
|
||||
|
||||
# Main neon glow with color cycling
|
||||
animation neon_main = rich_palette_animation(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation neon_main = rich_palette_animation(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
|
||||
# Add electrical flickering
|
||||
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
|
||||
|
||||
# Add neon tube segments with gaps
|
||||
color segment_pattern = rich_palette(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
color segment_pattern = rich_palette(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation segment1 = beacon_animation(
|
||||
color=segment_pattern # color source
|
||||
pos=6 # position
|
||||
|
||||
@ -13,10 +13,10 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Base ocean animation with slow color cycling
|
||||
animation ocean_base = rich_palette_animation(palette=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add wave motion with moving pulses
|
||||
color wave1_pattern = rich_palette(palette=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
animation wave1 = beacon_animation(
|
||||
color=wave1_pattern # color source
|
||||
pos=0 # initial position
|
||||
@ -26,7 +26,7 @@ animation wave1 = beacon_animation(
|
||||
wave1.priority = 10
|
||||
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
|
||||
|
||||
color wave2_pattern = rich_palette(palette=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
animation wave2 = beacon_animation(
|
||||
color=wave2_pattern # color source
|
||||
pos=52 # initial position
|
||||
|
||||
@ -16,9 +16,9 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Create animations using the palettes
|
||||
animation fire_anim = rich_palette_animation(palette=fire_colors, cycle_period=5s)
|
||||
animation fire_anim = rich_palette_animation(colors=fire_colors, cycle_period=5s)
|
||||
|
||||
animation ocean_anim = rich_palette_animation(palette=ocean_colors, cycle_period=8s)
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s)
|
||||
|
||||
# Sequence to show both palettes
|
||||
sequence palette_demo {
|
||||
|
||||
@ -44,13 +44,13 @@ palette sunset_sky = [
|
||||
]
|
||||
|
||||
# Create animations using each palette
|
||||
animation fire_effect = solid(color=rich_palette(palette=fire_gradient, cycle_period=3s))
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s))
|
||||
|
||||
animation ocean_waves = rich_palette_animation(palette=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
animation aurora_lights = rich_palette_animation(palette=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
|
||||
animation sunset_glow = rich_palette_animation(palette=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
|
||||
# Sequence to showcase all palettes
|
||||
sequence palette_showcase {
|
||||
|
||||
@ -14,10 +14,10 @@ palette plasma_colors = [
|
||||
]
|
||||
|
||||
# Base plasma animation with medium speed
|
||||
animation plasma_base = rich_palette_animation(palette=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add multiple wave layers for complexity
|
||||
color wave1_pattern = rich_palette(palette=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
animation plasma_wave1 = beacon_animation(
|
||||
color=wave1_pattern # color source
|
||||
pos=0 # initial position
|
||||
@ -27,7 +27,7 @@ animation plasma_wave1 = beacon_animation(
|
||||
plasma_wave1.priority = 10
|
||||
plasma_wave1.pos = smooth(min_value=0, max_value=40, duration=8s)
|
||||
|
||||
color wave2_pattern = rich_palette(palette=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
animation plasma_wave2 = beacon_animation(
|
||||
color=wave2_pattern # color source
|
||||
pos=45 # initial position
|
||||
@ -37,7 +37,7 @@ animation plasma_wave2 = beacon_animation(
|
||||
plasma_wave2.priority = 8
|
||||
plasma_wave2.pos = smooth(min_value=45, max_value=15, duration=10s) # Opposite direction
|
||||
|
||||
color wave3_pattern = rich_palette(palette=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
color wave3_pattern = rich_palette(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
animation plasma_wave3 = beacon_animation(
|
||||
color=wave3_pattern # color source
|
||||
pos=20 # initial position
|
||||
|
||||
@ -7,7 +7,7 @@ palette rainbow_palette = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8
|
||||
|
||||
# Create smooth rainbow cycle animation
|
||||
color rainbow_cycle = color_cycle(
|
||||
palette=rainbow_palette
|
||||
colors=rainbow_palette
|
||||
cycle_period=5s # cycle period
|
||||
)
|
||||
animation rainbow_animation = solid(color=rainbow_cycle)
|
||||
|
||||
@ -10,7 +10,7 @@ set brightness_low = 64
|
||||
|
||||
# Create color palette and cycling color
|
||||
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, cycle_period=0)
|
||||
|
||||
# Create animations
|
||||
animation red_eye = beacon_animation(
|
||||
|
||||
@ -13,7 +13,7 @@ palette rainbow = [
|
||||
]
|
||||
|
||||
# Create an animation using the palette
|
||||
animation rainbow_cycle = rich_palette_animation(palette=rainbow, cycle_period=3s)
|
||||
animation rainbow_cycle = rich_palette_animation(colors=rainbow, cycle_period=3s)
|
||||
|
||||
# Simple sequence
|
||||
sequence demo {
|
||||
|
||||
@ -17,7 +17,7 @@ palette daylight_colors = [
|
||||
]
|
||||
|
||||
# Main daylight cycle - very slow transition
|
||||
animation daylight_cycle = rich_palette_animation(palette=daylight_colors, cycle_period=60s)
|
||||
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, cycle_period=60s)
|
||||
|
||||
# Add sun position effect - bright spot that moves
|
||||
animation sun_position = beacon_animation(
|
||||
|
||||
@ -13,7 +13,7 @@ palette palette_olivary = [
|
||||
white
|
||||
]
|
||||
|
||||
color olivary = color_cycle(palette=palette_olivary, cycle_period=0)
|
||||
color olivary = color_cycle(colors=palette_olivary, cycle_period=0)
|
||||
|
||||
animation swipe_animation = solid(
|
||||
color = olivary
|
||||
|
||||
@ -7,7 +7,7 @@ template animation rainbow_pulse {
|
||||
param back_color type color
|
||||
|
||||
# Create color cycle using first palette
|
||||
color cycle_color = color_cycle(palette=pal1, cycle_period=period)
|
||||
color cycle_color = color_cycle(colors=pal1, cycle_period=period)
|
||||
|
||||
# Create pulsing animation
|
||||
animation pulse = pulsating_animation(
|
||||
|
||||
@ -9,8 +9,8 @@ template animation shutter_bidir {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len + 0, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -9,8 +9,8 @@ template animation shutter_central {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -9,8 +9,8 @@ template animation shutter_central {
|
||||
set strip_len2 = (strip_len + 1) / 2
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -183,7 +183,7 @@ class FireAnimation : animation.animation
|
||||
if resolved_color == nil
|
||||
# Create default fire palette on demand
|
||||
var fire_provider = animation.rich_palette(self.engine)
|
||||
fire_provider.palette = animation.PALETTE_FIRE
|
||||
fire_provider.colors = animation.PALETTE_FIRE
|
||||
fire_provider.cycle_period = 0 # Use value-based color mapping, not time-based
|
||||
fire_provider.transition_type = 1 # Use sine transition (smooth)
|
||||
fire_provider.brightness = 255
|
||||
|
||||
@ -46,7 +46,7 @@ class NoiseAnimation : animation.animation
|
||||
# Set default color if not set
|
||||
if self.color == nil
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
@ -99,7 +99,7 @@ class NoiseAnimation : animation.animation
|
||||
palette.add(value & 0xFF, 1) # B
|
||||
|
||||
var gradient_provider = animation.rich_palette(self.engine)
|
||||
gradient_provider.palette = palette
|
||||
gradient_provider.colors = palette
|
||||
gradient_provider.cycle_period = 5000
|
||||
gradient_provider.transition_type = 1
|
||||
gradient_provider.brightness = 255
|
||||
@ -260,7 +260,7 @@ def noise_rainbow(engine)
|
||||
var anim = animation.noise_animation(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
@ -287,7 +287,7 @@ def noise_fractal(engine)
|
||||
var anim = animation.noise_animation(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
|
||||
@ -17,7 +17,7 @@ class RichPaletteAnimation : animation.animation
|
||||
# Parameter definitions - only RichPaletteColorProvider parameters (Animation params inherited)
|
||||
static var PARAMS = animation.enc_params({
|
||||
# RichPaletteColorProvider parameters (forwarded to internal provider)
|
||||
"palette": {"type": "instance", "default": nil},
|
||||
"colors": {"type": "instance", "default": nil},
|
||||
"cycle_period": {"min": 0, "default": 5000},
|
||||
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.SINE},
|
||||
"brightness": {"min": 0, "max": 255, "default": 255}
|
||||
@ -44,7 +44,7 @@ class RichPaletteAnimation : animation.animation
|
||||
def on_param_changed(name, value)
|
||||
super(self).on_param_changed(name, value)
|
||||
# Forward rich palette parameters to internal color provider
|
||||
if name == "palette" || name == "cycle_period" || name == "transition_type" ||
|
||||
if name == "colors" || name == "cycle_period" || name == "transition_type" ||
|
||||
name == "brightness"
|
||||
# Set parameter on internal color provider
|
||||
self.color_provider.set_param(name, value)
|
||||
|
||||
@ -233,7 +233,7 @@ def wave_rainbow_sine(engine)
|
||||
var anim = animation.wave_animation(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1 # sine transition
|
||||
rainbow_provider.brightness = 255
|
||||
|
||||
@ -70,7 +70,7 @@ class PlasmaAnimation : animation.animation
|
||||
# Initialize default color if not set
|
||||
if self.color == nil
|
||||
var rainbow_provider = animation.rich_palette(self.engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
@ -89,7 +89,7 @@ class PlasmaAnimation : animation.animation
|
||||
if name == "color" && value == nil
|
||||
# Reset to default rainbow palette when color is set to nil
|
||||
var rainbow_provider = animation.rich_palette(self.engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
|
||||
@ -237,7 +237,7 @@ end
|
||||
# @return SparkleAnimation - A new rainbow sparkle animation instance
|
||||
def sparkle_rainbow(engine)
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.transition_type = 1 # sine transition
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
|
||||
# Parameter definitions
|
||||
static var PARAMS = animation.enc_params({
|
||||
"palette": {"type": "bytes", "default":nil},
|
||||
"colors": {"type": "bytes", "default":nil},
|
||||
"cycle_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
|
||||
"palette_size": {"type": "int", "default": 3} # Read-only: number of colors in palette
|
||||
@ -42,7 +42,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
# Get color at a specific index from bytes palette
|
||||
# We force alpha channel to 0xFF to force opaque colors
|
||||
def _get_color_at_index(idx)
|
||||
var palette_bytes = self.palette
|
||||
var palette_bytes = self.colors
|
||||
var palette_size = size(palette_bytes) / 4 # Each color is 4 bytes (AARRGGBB)
|
||||
|
||||
if (palette_size == 0) || (idx >= palette_size) || (idx < 0)
|
||||
@ -57,7 +57,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
|
||||
# Get the number of colors in the palette
|
||||
def _get_palette_size()
|
||||
return size(self.palette) / 4 # Each color is 4 bytes
|
||||
return size(self.colors) / 4 # Each color is 4 bytes
|
||||
end
|
||||
|
||||
# Virtual member access - implements the virtual "palette_size" attribute
|
||||
@ -70,7 +70,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
else
|
||||
var val = super(self).member(name)
|
||||
# If 'palette' is 'nil', default to 'animation.PALETTE_RAINBOW'
|
||||
if name == "palette" && val == nil
|
||||
if name == "colors" && val == nil
|
||||
val = animation.PALETTE_RAINBOW
|
||||
end
|
||||
return val
|
||||
|
||||
@ -42,7 +42,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
|
||||
# Parameter definitions
|
||||
static var PARAMS = animation.enc_params({
|
||||
"palette": {"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
|
||||
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.LINEAR}
|
||||
# brightness parameter inherited from ColorProvider base class
|
||||
@ -63,7 +63,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
self._light_state = global.light_state(global.light_state.RGB)
|
||||
|
||||
# Set default palette to animation.PALETTE_RAINBOW
|
||||
self.palette = animation.PALETTE_RAINBOW
|
||||
self.colors = animation.PALETTE_RAINBOW
|
||||
|
||||
# We need to register this value provider to receive 'update()'
|
||||
engine.add(self)
|
||||
@ -75,7 +75,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
# @param value: any - New value of the parameter
|
||||
def on_param_changed(name, value)
|
||||
super(self).on_param_changed(name, value)
|
||||
if name == "cycle_period" || name == "palette"
|
||||
if name == "cycle_period" || name == "colors"
|
||||
if (self._slots_arr != nil) || (self._value_arr != nil)
|
||||
# only if they were already computed
|
||||
self._recompute_palette()
|
||||
@ -83,7 +83,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
end
|
||||
# Mark LUT as dirty when palette or transition_type changes
|
||||
# Note: brightness changes do NOT invalidate LUT since brightness is applied after lookup
|
||||
if name == "palette" || name == "transition_type"
|
||||
if name == "colors" || name == "transition_type"
|
||||
self._lut_dirty = true
|
||||
end
|
||||
# Brightness changes do NOT invalidate LUT - brightness is applied after lookup
|
||||
@ -104,7 +104,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
|
||||
# Get palette bytes from parameter with default fallback
|
||||
def _get_palette_bytes()
|
||||
var palette_bytes = self.palette
|
||||
var palette_bytes = self.colors
|
||||
return (palette_bytes != nil) ? palette_bytes : self._DEFAULT_PALETTE
|
||||
end
|
||||
static _DEFAULT_PALETTE = bytes(
|
||||
|
||||
@ -314,7 +314,7 @@ static const bvalue be_ktab_class_RichPaletteAnimation[13] = {
|
||||
/* K5 */ be_nested_str_weak(color),
|
||||
/* K6 */ be_nested_str_weak(start),
|
||||
/* K7 */ be_nested_str_weak(on_param_changed),
|
||||
/* K8 */ be_nested_str_weak(palette),
|
||||
/* K8 */ be_nested_str_weak(colors),
|
||||
/* K9 */ be_nested_str_weak(cycle_period),
|
||||
/* K10 */ be_nested_str_weak(transition_type),
|
||||
/* K11 */ be_nested_str_weak(brightness),
|
||||
@ -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_map( * be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(palette, -1), be_const_bytes_instance(0C0605) },
|
||||
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400050200010005) },
|
||||
{ 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(cycle_period, 1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(cycle_period, 0), be_const_bytes_instance(050000018813) },
|
||||
})) ) } )) },
|
||||
{ be_const_key_weak(color_provider, -1), be_const_var(0) },
|
||||
})),
|
||||
@ -524,7 +524,7 @@ be_local_closure(noise_rainbow, /* name */
|
||||
/* K0 */ be_nested_str_weak(animation),
|
||||
/* K1 */ be_nested_str_weak(noise_animation),
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
@ -1766,7 +1766,7 @@ static const bvalue be_ktab_class_FireAnimation[47] = {
|
||||
/* K36 */ be_const_int(3),
|
||||
/* K37 */ be_nested_str_weak(animation),
|
||||
/* K38 */ be_nested_str_weak(rich_palette),
|
||||
/* K39 */ be_nested_str_weak(palette),
|
||||
/* K39 */ be_nested_str_weak(colors),
|
||||
/* K40 */ be_nested_str_weak(PALETTE_FIRE),
|
||||
/* K41 */ be_nested_str_weak(cycle_period),
|
||||
/* K42 */ be_nested_str_weak(transition_type),
|
||||
@ -2393,7 +2393,7 @@ static const bvalue be_ktab_class_RichPaletteColorProvider[58] = {
|
||||
/* K18 */ be_nested_str_weak(_brightness),
|
||||
/* K19 */ be_nested_str_weak(member),
|
||||
/* K20 */ be_nested_str_weak(brightness),
|
||||
/* K21 */ be_nested_str_weak(palette),
|
||||
/* K21 */ be_nested_str_weak(colors),
|
||||
/* K22 */ be_nested_str_weak(_DEFAULT_PALETTE),
|
||||
/* K23 */ be_nested_str_weak(background_X3Alinear_X2Dgradient_X28to_X20right_X2C_X20_X23000000_X29_X3B),
|
||||
/* K24 */ be_nested_str_weak(_parse_palette),
|
||||
@ -3598,7 +3598,7 @@ be_local_class(RichPaletteColorProvider,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(cycle_period, 1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400010200010005) },
|
||||
{ be_const_key_weak(palette, -1), be_const_bytes_instance(0C0602) },
|
||||
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) },
|
||||
})) ) } )) },
|
||||
{ be_const_key_weak(_slots_arr, -1), be_const_var(0) },
|
||||
{ be_const_key_weak(_DEFAULT_PALETTE, 0), be_const_bytes_instance(00FF000024FFA50049FFFF006E00FF00920000FFB74B0082DBEE82EEFFFF0000) },
|
||||
@ -3735,7 +3735,7 @@ static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
|
||||
/* 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),
|
||||
/* K11 */ be_nested_str_weak(manual),
|
||||
/* K12 */ be_nested_str_weak(auto),
|
||||
/* K13 */ be_nested_str_weak(palette),
|
||||
/* K13 */ be_nested_str_weak(colors),
|
||||
/* K14 */ be_nested_str_weak(on_param_changed),
|
||||
/* K15 */ be_nested_str_weak(palette_size),
|
||||
/* K16 */ be_nested_str_weak(values),
|
||||
@ -4205,9 +4205,9 @@ be_local_class(ColorCycleColorProvider,
|
||||
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
|
||||
be_const_map( * be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(palette, 2), be_const_bytes_instance(0C0602) },
|
||||
{ be_const_key_weak(next, 2), be_const_bytes_instance(040000) },
|
||||
{ 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(next, 1), be_const_bytes_instance(040000) },
|
||||
{ be_const_key_weak(cycle_period, -1), be_const_bytes_instance(050000018813) },
|
||||
})) ) } )) },
|
||||
{ be_const_key_weak(init, -1), be_const_closure(class_ColorCycleColorProvider_init_closure) },
|
||||
@ -7841,7 +7841,7 @@ static const bvalue be_ktab_class_NoiseAnimation[49] = {
|
||||
/* K10 */ be_nested_str_weak(color),
|
||||
/* K11 */ be_nested_str_weak(animation),
|
||||
/* K12 */ be_nested_str_weak(rich_palette),
|
||||
/* K13 */ be_nested_str_weak(palette),
|
||||
/* K13 */ be_nested_str_weak(colors),
|
||||
/* K14 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K15 */ be_nested_str_weak(cycle_period),
|
||||
/* K16 */ be_nested_str_weak(transition_type),
|
||||
@ -10608,7 +10608,7 @@ be_local_closure(wave_rainbow_sine, /* name */
|
||||
/* K0 */ be_nested_str_weak(animation),
|
||||
/* K1 */ be_nested_str_weak(wave_animation),
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
@ -17954,7 +17954,7 @@ be_local_closure(noise_fractal, /* name */
|
||||
/* K0 */ be_nested_str_weak(animation),
|
||||
/* K1 */ be_nested_str_weak(noise_animation),
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
|
||||
@ -65,12 +65,12 @@ class ColorCycleAnimationTest
|
||||
# Check that the color was set correctly
|
||||
self.assert_equal(anim.color != nil, true, "Color is set")
|
||||
var color_provider = anim.get_param("color") # Get raw provider object
|
||||
self.assert_equal(color_provider.palette != nil, true, "Color provider has palette property")
|
||||
self.assert_equal(color_provider.colors != nil, true, "Color provider has colors property")
|
||||
|
||||
# Test with custom parameters
|
||||
var custom_palette = bytes("FFFF0000FF00FF00") # Red and Green in AARRGGBB format
|
||||
var custom_provider = animation.color_cycle(engine)
|
||||
custom_provider.palette = custom_palette
|
||||
custom_provider.colors = custom_palette
|
||||
custom_provider.cycle_period = 2000
|
||||
|
||||
var anim2 = animation.solid(engine)
|
||||
@ -83,18 +83,18 @@ class ColorCycleAnimationTest
|
||||
# Check that the color was set correctly
|
||||
self.assert_equal(anim2.color != nil, true, "Custom color is set")
|
||||
var color_provider2 = anim2.get_param("color") # Get raw provider object
|
||||
self.assert_equal(color_provider2.palette != nil, true, "Custom color provider has palette property")
|
||||
self.assert_equal(color_provider2.colors != nil, true, "Custom color provider has colors property")
|
||||
|
||||
# Check provider properties
|
||||
self.assert_equal(color_provider2._get_palette_size(), 2, "Custom palette 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")
|
||||
end
|
||||
|
||||
def test_update_and_render()
|
||||
# Create animation with red and blue colors
|
||||
var palette = bytes("FFFF0000FF0000FF") # Red and Blue in AARRGGBB format
|
||||
var colors = bytes("FFFF0000FF0000FF") # Red and Blue in AARRGGBB format
|
||||
var provider = animation.color_cycle(engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 1000 # 1 second cycle
|
||||
|
||||
var anim = animation.solid(engine)
|
||||
@ -142,7 +142,7 @@ class ColorCycleAnimationTest
|
||||
|
||||
# Create animation with manual-only color provider
|
||||
var manual_provider = animation.color_cycle(engine)
|
||||
manual_provider.palette = 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
|
||||
|
||||
var manual_anim = animation.solid(engine)
|
||||
@ -191,7 +191,7 @@ class ColorCycleAnimationTest
|
||||
def test_direct_creation()
|
||||
# Test direct creation without factory method (following new parameterized pattern)
|
||||
var provider = animation.color_cycle(engine)
|
||||
provider.palette = 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
|
||||
|
||||
var anim = animation.solid(engine)
|
||||
@ -205,7 +205,7 @@ class ColorCycleAnimationTest
|
||||
self.assert_equal(anim != nil, true, "Animation was created")
|
||||
self.assert_equal(anim.render != nil, true, "Animation has render method")
|
||||
var color_provider3 = anim.get_param("color") # Get raw provider object
|
||||
self.assert_equal(color_provider3.palette != nil, true, "Color provider has palette property")
|
||||
self.assert_equal(color_provider3.colors != nil, true, "Color provider has colors property")
|
||||
|
||||
# Check provider properties
|
||||
self.assert_equal(color_provider3._get_palette_size(), 3, "Palette has 3 colors")
|
||||
|
||||
@ -38,7 +38,7 @@ def test_color_cycle_bytes_format()
|
||||
"FFFFFF00" # Opaque yellow (alpha=0xFF)
|
||||
)
|
||||
|
||||
provider.palette = custom_palette
|
||||
provider.colors = custom_palette
|
||||
var custom_size = provider._get_palette_size()
|
||||
assert(custom_size == 4, f"Custom palette should have 4 colors, got {custom_size}")
|
||||
|
||||
@ -103,7 +103,7 @@ def test_color_cycle_bytes_format()
|
||||
|
||||
# Test 11: Test empty palette handling
|
||||
var empty_palette = bytes()
|
||||
provider.palette = empty_palette
|
||||
provider.colors = empty_palette
|
||||
var empty_size = provider._get_palette_size()
|
||||
assert(empty_size == 0, f"Empty palette should have 0 colors")
|
||||
|
||||
@ -121,7 +121,7 @@ def test_bytes_parameter_validation()
|
||||
|
||||
# Test 1: Valid bytes palette should be accepted
|
||||
var valid_palette = bytes("FF0000FFFF00FF00FFFF0000")
|
||||
provider.palette = valid_palette
|
||||
provider.colors = valid_palette
|
||||
assert(provider.palette_size == 3, "Valid bytes palette should be accepted")
|
||||
|
||||
# Test 2: Invalid types should be rejected
|
||||
@ -130,7 +130,7 @@ def test_bytes_parameter_validation()
|
||||
for invalid_val : invalid_types
|
||||
var caught_error = false
|
||||
try
|
||||
provider.palette = invalid_val
|
||||
provider.colors = invalid_val
|
||||
except "value_error"
|
||||
caught_error = true
|
||||
end
|
||||
|
||||
@ -76,25 +76,25 @@ def test_palette_size_updates_with_palette_changes()
|
||||
|
||||
# Test 1: 2-color palette
|
||||
var palette_2 = bytes("FFFF0000" "FF00FF00")
|
||||
provider.palette = palette_2
|
||||
provider.colors = palette_2
|
||||
var size_2 = provider.palette_size
|
||||
assert(size_2 == 2, f"palette_size should be 2 for 2-color palette, got {size_2}")
|
||||
|
||||
# Test 2: 5-color palette
|
||||
var palette_5 = bytes("FFFF0000" "FF00FF00" "FF0000FF" "FFFFFF00" "FFFF00FF")
|
||||
provider.palette = palette_5
|
||||
provider.colors = palette_5
|
||||
var size_5 = provider.palette_size
|
||||
assert(size_5 == 5, f"palette_size should be 5 for 5-color palette, got {size_5}")
|
||||
|
||||
# Test 3: 1-color palette
|
||||
var palette_1 = bytes("FFFF0000")
|
||||
provider.palette = palette_1
|
||||
provider.colors = palette_1
|
||||
var size_1 = provider.palette_size
|
||||
assert(size_1 == 1, f"palette_size should be 1 for 1-color palette, got {size_1}")
|
||||
|
||||
# Test 4: Empty palette
|
||||
var empty_palette = bytes()
|
||||
provider.palette = empty_palette
|
||||
provider.colors = empty_palette
|
||||
var size_0 = provider.palette_size
|
||||
assert(size_0 == 0, f"palette_size should be 0 for empty palette, got {size_0}")
|
||||
|
||||
@ -103,7 +103,7 @@ def test_palette_size_updates_with_palette_changes()
|
||||
"FFFF0000" "FF00FF00" "FF0000FF" "FFFFFF00" "FFFF00FF"
|
||||
"FF800000" "FF008000" "FF000080" "FF808000" "FF800080"
|
||||
)
|
||||
provider.palette = palette_10
|
||||
provider.colors = palette_10
|
||||
var size_10 = provider.palette_size
|
||||
assert(size_10 == 10, f"palette_size should be 10 for 10-color palette, got {size_10}")
|
||||
|
||||
@ -136,7 +136,7 @@ def test_palette_size_with_new_instances()
|
||||
|
||||
# Test 2: Changing one instance shouldn't affect the other
|
||||
var custom_palette = bytes("FFFF0000" "FF00FF00")
|
||||
provider1.palette = custom_palette
|
||||
provider1.colors = custom_palette
|
||||
|
||||
assert(provider1.palette_size == 2, "First provider should have palette_size of 2 after change")
|
||||
assert(provider2.palette_size == 7, "Second provider should still have palette_size of 7")
|
||||
|
||||
@ -98,7 +98,7 @@ def test_crenel_with_dynamic_color_provider()
|
||||
|
||||
# Create a palette color provider that changes over time
|
||||
var palette_provider = animation.color_cycle(engine)
|
||||
palette_provider.palette = 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
|
||||
|
||||
# Create animation with new parameterized pattern
|
||||
|
||||
@ -47,7 +47,7 @@ def test_palette_newline_entries()
|
||||
" (192, 0x00AA00)\n" +
|
||||
" (255, 0x00FF00)\n" +
|
||||
"]\n" +
|
||||
"color stream_color = rich_palette(palette=matrix_greens, cycle_period=2s)\n" +
|
||||
"color stream_color = rich_palette(colors=matrix_greens, cycle_period=2s)\n" +
|
||||
"animation stream = solid(color=stream_color)\n" +
|
||||
"run stream"
|
||||
|
||||
@ -112,7 +112,7 @@ def test_color_provider_newline_syntax()
|
||||
var dsl_source =
|
||||
"palette test_palette = [(0, 0x000000), (255, 0xFFFFFF)]\n" +
|
||||
"color dynamic_color = rich_palette(\n" +
|
||||
" palette=test_palette\n" +
|
||||
" colors=test_palette\n" +
|
||||
" cycle_period=2s\n" +
|
||||
" transition_type=LINEAR\n" +
|
||||
" brightness=255\n" +
|
||||
@ -124,7 +124,7 @@ def test_color_provider_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, "dynamic_color_.palette = 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")
|
||||
|
||||
print("✓ Color provider newline syntax test passed")
|
||||
@ -173,7 +173,7 @@ def test_complex_example()
|
||||
"]\n" +
|
||||
"\n" +
|
||||
"color stream_pattern = rich_palette(\n" +
|
||||
" palette=matrix_greens\n" +
|
||||
" colors=matrix_greens\n" +
|
||||
" cycle_period=2s\n" +
|
||||
" transition_type=LINEAR\n" +
|
||||
" brightness=255\n" +
|
||||
|
||||
@ -253,7 +253,7 @@ def test_complex_scenario()
|
||||
var dsl_source = "# Complex cylon eye with restart functionality\n" +
|
||||
"set strip_len = strip_length()\n" +
|
||||
"palette eye_palette = [ red, yellow, green, violet ]\n" +
|
||||
"color eye_color = color_cycle(palette=eye_palette, cycle_period=0)\n" +
|
||||
"color eye_color = color_cycle(colors=eye_palette, cycle_period=0)\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" +
|
||||
"\n" +
|
||||
|
||||
@ -116,7 +116,7 @@ class DSLTemplateAnimationTest
|
||||
" param my_color type palette\n" +
|
||||
" param my_duration type time\n" +
|
||||
" \n" +
|
||||
" color col = color_cycle(palette=my_color, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=my_color, cycle_period=0)\n" +
|
||||
" animation test = pulsating_animation(color=col, period=my_duration)\n" +
|
||||
" run test\n" +
|
||||
"}\n"
|
||||
@ -170,7 +170,7 @@ class DSLTemplateAnimationTest
|
||||
" param colors type palette\n" +
|
||||
" param duration type time\n" +
|
||||
" \n" +
|
||||
" color col = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" animation anim = solid(color=col)\n" +
|
||||
" \n" +
|
||||
" sequence seq repeat forever {\n" +
|
||||
@ -231,7 +231,7 @@ class DSLTemplateAnimationTest
|
||||
" param duration type time min 1 max 10 default 5\n" +
|
||||
" param intensity type number min 0 max 255 default 200\n" +
|
||||
" \n" +
|
||||
" color col = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" animation test = solid(color=col)\n" +
|
||||
" test.opacity = intensity\n" +
|
||||
" run test\n" +
|
||||
@ -294,7 +294,7 @@ class DSLTemplateAnimationTest
|
||||
" param colors type palette\n" +
|
||||
" param duration type time\n" +
|
||||
" \n" +
|
||||
" color col = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" animation test = solid(color=col)\n" +
|
||||
" \n" +
|
||||
" sequence seq repeat forever {\n" +
|
||||
@ -474,7 +474,7 @@ class DSLTemplateAnimationTest
|
||||
" set strip_len = strip_length()\n" +
|
||||
" set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" +
|
||||
" \n" +
|
||||
" color col = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" animation test = beacon_animation(color=col, beacon_size=shutter_size)\n" +
|
||||
" \n" +
|
||||
" sequence seq repeat forever {\n" +
|
||||
@ -546,8 +546,8 @@ class DSLTemplateAnimationTest
|
||||
" set strip_len2 = (strip_len + 1) / 2\n" +
|
||||
" set shutter_size = sawtooth(min_value=0, max_value=strip_len, duration=duration)\n" +
|
||||
" \n" +
|
||||
" color col1 = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col2 = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col1 = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" color col2 = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" col2.next = 1\n" +
|
||||
" \n" +
|
||||
" animation shutter = beacon_animation(\n" +
|
||||
|
||||
@ -262,7 +262,7 @@ print(repeat_berry_code)
|
||||
# Test complex cylon rainbow example
|
||||
var cylon_dsl = "set strip_len = strip_length()\n" +
|
||||
"palette eye_palette = [ red, yellow, green, violet ]\n" +
|
||||
"color eye_color = color_cycle(palette=eye_palette, cycle_period=0)\n" +
|
||||
"color eye_color = color_cycle(colors=eye_palette, cycle_period=0)\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" +
|
||||
"\n" +
|
||||
@ -991,7 +991,7 @@ def test_animation_type_checking()
|
||||
|
||||
# Test color provider assigned to animation (should fail at transpile time)
|
||||
var color_provider_as_animation_dsl = "# strip length 30 # TEMPORARILY DISABLED\n" +
|
||||
"animation invalid_anim = rich_palette(palette=breathe_palette)"
|
||||
"animation invalid_anim = rich_palette(colors=breathe_palette)"
|
||||
|
||||
try
|
||||
var invalid_code = animation_dsl.compile(color_provider_as_animation_dsl)
|
||||
@ -1023,7 +1023,7 @@ def test_color_type_checking()
|
||||
|
||||
# Test color provider functions (if they exist)
|
||||
var color_provider_dsl = "# strip length 30 # TEMPORARILY DISABLED\n" +
|
||||
"color cycle_colors = color_cycle(palette=[0xFF0000, 0x00FF00, 0x0000FF])\n" +
|
||||
"color cycle_colors = color_cycle(colors=[0xFF0000, 0x00FF00, 0x0000FF])\n" +
|
||||
"animation cycle_anim = solid(color=cycle_colors)\n" +
|
||||
"run cycle_anim"
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ class DSLValueProviderValidationTest
|
||||
def test_nested_value_providers()
|
||||
var dsl_code =
|
||||
"# strip length 30 # TEMPORARILY DISABLED\n"
|
||||
"animation test = pulsating_animation(color=color_cycle(palette=[0xFF0000FF, 0xFF00FF00], cycle_period=oscillator_value(min_value=1000, bad_param=456)))\n"
|
||||
"animation test = pulsating_animation(color=color_cycle(colors=[0xFF0000FF, 0xFF00FF00], cycle_period=oscillator_value(min_value=1000, bad_param=456)))\n"
|
||||
"run test"
|
||||
|
||||
var compilation_failed = false
|
||||
|
||||
@ -57,7 +57,7 @@ assert(pixel_color == 0xFF0000FF, f"Expected 0xFF0000FF, got {pixel_color:08X}")
|
||||
# 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)
|
||||
cycle_provider.palette = 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
|
||||
# Note: transition_type removed - now uses "brutal" color switching
|
||||
|
||||
@ -82,7 +82,7 @@ assert(result, "Render should return true")
|
||||
# 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)
|
||||
rich_provider.palette = 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
|
||||
# Note: transition_type removed - rich palette uses smooth transitions
|
||||
rich_provider.brightness = 255 # Full brightness
|
||||
@ -108,7 +108,7 @@ assert(result, "Render should return true")
|
||||
# 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)
|
||||
rich_provider2.palette = animation.PALETTE_RAINBOW
|
||||
rich_provider2.colors = animation.PALETTE_RAINBOW
|
||||
rich_provider2.cycle_period = 1000
|
||||
# Note: transition_type removed
|
||||
rich_provider2.brightness = 255
|
||||
|
||||
@ -111,7 +111,7 @@ print("Set to solid red color")
|
||||
|
||||
# Set back to fire palette
|
||||
var fire_palette = animation.rich_palette(engine)
|
||||
fire_palette.palette = animation.PALETTE_FIRE
|
||||
fire_palette.colors = animation.PALETTE_FIRE
|
||||
fire_palette.cycle_period = 5000
|
||||
fire_palette.transition_type = 1 # Use sine transition (smooth)
|
||||
fire_palette.brightness = 255
|
||||
|
||||
@ -34,7 +34,7 @@ var rainbow_with_white = bytes(
|
||||
|
||||
# Create a rich palette color provider
|
||||
var rainbow_rich_color = animation.rich_palette(engine)
|
||||
rainbow_rich_color.palette = rainbow_with_white
|
||||
rainbow_rich_color.colors = rainbow_with_white
|
||||
rainbow_rich_color.cycle_period = 10000 # 10 seconds
|
||||
rainbow_rich_color.transition_type = animation.SINE
|
||||
|
||||
|
||||
@ -608,7 +608,7 @@ def test_alternative_syntax_integration()
|
||||
" 0xFFFF00\n" +
|
||||
"]\n" +
|
||||
"\n" +
|
||||
"color rich_palette2 = color_cycle(palette=fire_colors, cycle_period=3s)\n"
|
||||
"color rich_palette2 = color_cycle(colors=fire_colors, cycle_period=3s)\n"
|
||||
"animation fire_anim = solid(color=rich_palette2)\n" +
|
||||
"\n" +
|
||||
"run fire_anim\n"
|
||||
|
||||
@ -24,7 +24,7 @@ print(f"Animation created: {anim}")
|
||||
print(f"Animation type: {type(anim)}")
|
||||
|
||||
# Test 2: Set parameters using virtual member assignment (parameter forwarding)
|
||||
anim.palette = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
anim.colors = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
anim.cycle_period = 3000
|
||||
anim.transition_type = 1 # sine
|
||||
anim.brightness = 200
|
||||
@ -38,7 +38,7 @@ anim.opacity = 255
|
||||
print("Set parameters using virtual member assignment")
|
||||
|
||||
# Test parameter values (should be forwarded to internal provider)
|
||||
print(f"Palette: {bool(anim.palette)}")
|
||||
print(f"Palette: {bool(anim.colors)}")
|
||||
print(f"Cycle period: {anim.cycle_period}")
|
||||
print(f"Transition type: {anim.transition_type}")
|
||||
print(f"Brightness: {anim.brightness}")
|
||||
@ -104,14 +104,14 @@ var rainbow_palette = bytes(
|
||||
)
|
||||
|
||||
var rainbow_anim = animation.rich_palette_animation(engine)
|
||||
rainbow_anim.palette = rainbow_palette
|
||||
rainbow_anim.colors = rainbow_palette
|
||||
rainbow_anim.cycle_period = 5000
|
||||
rainbow_anim.brightness = 255
|
||||
print("Created rainbow animation with custom palette")
|
||||
|
||||
# Test 9: Test static mode (cycle_period = 0)
|
||||
var static_anim = animation.rich_palette_animation(engine)
|
||||
static_anim.palette = rainbow_palette
|
||||
static_anim.colors = rainbow_palette
|
||||
static_anim.cycle_period = 0 # Static mode
|
||||
static_anim.brightness = 150
|
||||
print("Created static animation (cycle_period = 0)")
|
||||
|
||||
@ -94,7 +94,7 @@ class RichPaletteAnimationTest
|
||||
# Test with custom parameters using new parameterized class specification
|
||||
var custom_palette = bytes("00FF0000" "FFFFFF00")
|
||||
var custom_provider = animation.rich_palette(mock_engine)
|
||||
custom_provider.palette = custom_palette
|
||||
custom_provider.colors = custom_palette
|
||||
custom_provider.cycle_period = 2000
|
||||
custom_provider.transition_type = animation.SINE
|
||||
custom_provider.brightness = 128
|
||||
@ -114,9 +114,9 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_update_and_render()
|
||||
# Create animation with red and blue colors
|
||||
var palette = bytes("00FF0000" "FF0000FF") # Red to Blue in VRGB format
|
||||
var colors = bytes("00FF0000" "FF0000FF") # Red to Blue in VRGB format
|
||||
var provider = animation.rich_palette(mock_engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 1000 # 1 second cycle
|
||||
provider.transition_type = animation.LINEAR # linear transition
|
||||
|
||||
@ -166,9 +166,9 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_palette_properties()
|
||||
# Test palette properties and value-based color generation
|
||||
var palette = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var colors = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var provider = animation.rich_palette(mock_engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 1000
|
||||
|
||||
# Check basic properties
|
||||
@ -195,9 +195,9 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_css_gradient()
|
||||
# Test CSS gradient generation
|
||||
var palette = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var colors = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var provider = animation.rich_palette(mock_engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 1000
|
||||
|
||||
var css = provider.to_css_gradient()
|
||||
@ -215,9 +215,9 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_cycle_period_zero()
|
||||
# Test the new cycle_period = 0 functionality for value-based color mapping
|
||||
var palette = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var colors = bytes("00FF0000" "80FFFF00" "FF0000FF") # Red to Yellow to Blue
|
||||
var provider = animation.rich_palette(mock_engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 0 # Value-based mode
|
||||
provider.start()
|
||||
provider.update()
|
||||
@ -264,11 +264,11 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_sine_mode()
|
||||
# Test SINE mode for smooth ease-in/ease-out transitions
|
||||
var palette = bytes("00FF0000" "FF0000FF") # Red at 0, Blue at 255
|
||||
var colors = bytes("00FF0000" "FF0000FF") # Red at 0, Blue at 255
|
||||
|
||||
# Create LINEAR provider
|
||||
var provider_linear = animation.rich_palette(mock_engine)
|
||||
provider_linear.palette = palette
|
||||
provider_linear.colors = colors
|
||||
provider_linear.cycle_period = 1000
|
||||
provider_linear.transition_type = animation.LINEAR
|
||||
provider_linear.brightness = 255
|
||||
@ -276,7 +276,7 @@ class RichPaletteAnimationTest
|
||||
|
||||
# Create SINE provider
|
||||
var provider_sine = animation.rich_palette(mock_engine)
|
||||
provider_sine.palette = palette
|
||||
provider_sine.colors = colors
|
||||
provider_sine.cycle_period = 1000
|
||||
provider_sine.transition_type = animation.SINE
|
||||
provider_sine.brightness = 255
|
||||
@ -325,9 +325,9 @@ class RichPaletteAnimationTest
|
||||
|
||||
def test_sine_mode_value_based()
|
||||
# Test SINE mode with value-based interpolation
|
||||
var palette = bytes("00FF0000" "FF0000FF") # Red to Blue
|
||||
var colors = bytes("00FF0000" "FF0000FF") # Red to Blue
|
||||
var provider = animation.rich_palette(mock_engine)
|
||||
provider.palette = palette
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 0 # Value-based mode
|
||||
provider.transition_type = animation.SINE
|
||||
provider.start()
|
||||
|
||||
@ -36,7 +36,7 @@ var rainbow_palette = bytes(
|
||||
|
||||
# Create the color provider
|
||||
var provider = animation.rich_palette(engine)
|
||||
provider.palette = rainbow_palette
|
||||
provider.colors = rainbow_palette
|
||||
provider.cycle_period = 0 # Value-based mode for gradient
|
||||
provider.brightness = 255
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ var rgb_palette = bytes(
|
||||
)
|
||||
|
||||
var provider = animation.rich_palette(engine)
|
||||
provider.palette = rgb_palette
|
||||
provider.colors = rgb_palette
|
||||
provider.cycle_period = 0 # Static mode
|
||||
|
||||
# Initialize the provider and build LUT
|
||||
@ -143,7 +143,7 @@ log("---------------------------------")
|
||||
|
||||
# Create a fresh provider
|
||||
var rebuild_provider = animation.rich_palette(engine)
|
||||
rebuild_provider.palette = rgb_palette
|
||||
rebuild_provider.colors = rgb_palette
|
||||
rebuild_provider.cycle_period = 0
|
||||
|
||||
# Force initial build
|
||||
@ -157,7 +157,7 @@ rebuild_provider.get_color_for_value(128, 0)
|
||||
log(f"After lookup with new brightness: lut_dirty = {rebuild_provider._lut_dirty}")
|
||||
|
||||
# Change palette - SHOULD trigger rebuild
|
||||
rebuild_provider.palette = bytes("00FF0000" "FFFFFF00")
|
||||
rebuild_provider.colors = bytes("00FF0000" "FFFFFF00")
|
||||
log(f"After palette change: lut_dirty = {rebuild_provider._lut_dirty}")
|
||||
rebuild_provider.get_color_for_value(128, 0)
|
||||
log(f"After lookup with new palette: lut_dirty = {rebuild_provider._lut_dirty}")
|
||||
|
||||
@ -42,7 +42,7 @@ end
|
||||
log("")
|
||||
|
||||
var provider = animation.rich_palette(engine)
|
||||
provider.palette = rainbow_palette
|
||||
provider.colors = rainbow_palette
|
||||
provider.cycle_period = 0 # Static mode for testing
|
||||
|
||||
# Trigger initialization by calling produce_value once
|
||||
@ -50,7 +50,7 @@ provider.cycle_period = 0 # Static mode for testing
|
||||
provider.produce_value("color", 0)
|
||||
|
||||
# Debug: Check palette
|
||||
log(f"Palette size: {size(provider.palette)} bytes")
|
||||
log(f"Palette size: {size(provider.colors)} bytes")
|
||||
log(f"Slots: {provider._slots}")
|
||||
log("Range: 0 to 255 (fixed)")
|
||||
|
||||
@ -86,7 +86,7 @@ provider.transition_type = animation.SINE
|
||||
log(f"After transition_type change: _lut_dirty = {provider._lut_dirty}")
|
||||
|
||||
provider._lut_dirty = false
|
||||
provider.palette = bytes("00FF0000" "FFFFFF00" "FF00FF00")
|
||||
provider.colors = bytes("00FF0000" "FFFFFF00" "FF00FF00")
|
||||
log(f"After palette change: _lut_dirty = {provider._lut_dirty}")
|
||||
|
||||
log("")
|
||||
@ -97,7 +97,7 @@ log("-------------------------------")
|
||||
|
||||
# Create a fresh provider for performance testing
|
||||
var perf_provider = animation.rich_palette(engine)
|
||||
perf_provider.palette = rainbow_palette
|
||||
perf_provider.colors = rainbow_palette
|
||||
perf_provider.cycle_period = 0
|
||||
|
||||
# Warm up the LUT
|
||||
|
||||
@ -652,7 +652,7 @@ def test_sequence_manager_complex_parametric_scenario()
|
||||
}
|
||||
|
||||
var color_cycle1 = {
|
||||
"palette": rainbow_palette,
|
||||
"colors": rainbow_palette,
|
||||
"current_index": 0,
|
||||
"palette_size": rainbow_palette["size"]
|
||||
}
|
||||
@ -753,7 +753,7 @@ def test_sequence_manager_zero_palette_size()
|
||||
|
||||
# Create a color cycle with empty palette (palette_size = 0)
|
||||
var col1 = animation.color_cycle(engine)
|
||||
col1.palette = bytes() # Empty palette
|
||||
col1.colors = bytes() # Empty palette
|
||||
col1.cycle_period = 0
|
||||
|
||||
# Verify palette size is 0
|
||||
@ -780,7 +780,7 @@ def test_sequence_manager_zero_palette_size()
|
||||
# Test with non-empty palette for comparison
|
||||
execution_count = 0
|
||||
var col2 = animation.color_cycle(engine)
|
||||
col2.palette = bytes("FFFF0000" "FF00FF00" "FF0000FF") # 3 colors
|
||||
col2.colors = bytes("FFFF0000" "FF00FF00" "FF0000FF") # 3 colors
|
||||
col2.cycle_period = 0
|
||||
|
||||
assert(col2.palette_size == 3, f"Palette with 3 colors should have size 3, got {col2.palette_size}")
|
||||
|
||||
@ -66,7 +66,7 @@ def test_multiple_providers_coordination()
|
||||
brightness_osc.duration = 2000
|
||||
|
||||
var color_cycle = animation.color_cycle(engine)
|
||||
color_cycle.palette = bytes("FFFF0000" "FF00FF00" "FF0000FF")
|
||||
color_cycle.colors = bytes("FFFF0000" "FF00FF00" "FF0000FF")
|
||||
color_cycle.cycle_period = 5000
|
||||
|
||||
# Create animation using all providers
|
||||
|
||||
Loading…
Reference in New Issue
Block a user