Berry animation rename cycle_period to period (#24260)
This commit is contained in:
parent
f82cbeb2aa
commit
7a0c639bd4
@ -56,7 +56,7 @@ run pulse
|
||||
### Rainbow Smooth Color Cycling
|
||||
|
||||
```berry
|
||||
animation rainbow = rich_palette_animation(palette=PALETTE_RAINBOW)
|
||||
animation rainbow = rich_palette_animation(colors=PALETTE_RAINBOW)
|
||||
run rainbow
|
||||
```
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ palette breathe_palette = [
|
||||
# Create a rich palette color provider
|
||||
color palette_pattern = rich_palette(
|
||||
colors=breathe_palette # palette
|
||||
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
)
|
||||
|
||||
# Create breathing animation using the palette
|
||||
|
||||
@ -17,7 +17,7 @@ palette ornament_colors = [
|
||||
]
|
||||
|
||||
# Colorful ornaments as twinkling lights
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation ornaments = twinkle_animation(
|
||||
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(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
color garland_pattern = rich_palette(colors=ornament_colors, period=2s, transition_type=LINEAR, brightness=200)
|
||||
animation garland = comet_animation(
|
||||
color=garland_pattern # color source
|
||||
tail_length=6 # garland length (tail length)
|
||||
|
||||
@ -30,7 +30,7 @@ var breathe_palette_ = bytes(
|
||||
# Create a rich palette color provider
|
||||
var palette_pattern_ = animation.rich_palette(engine)
|
||||
palette_pattern_.colors = breathe_palette_ # palette
|
||||
palette_pattern_.cycle_period = 15000 # cycle period (defaults: smooth transition, 255 brightness)
|
||||
palette_pattern_.period = 15000 # cycle period (defaults: smooth transition, 255 brightness)
|
||||
# Create breathing animation using the palette
|
||||
var breathing_ = animation.breathe_animation(engine)
|
||||
breathing_.color = palette_pattern_ # base animation
|
||||
@ -76,7 +76,7 @@ palette breathe_palette = [
|
||||
# Create a rich palette color provider
|
||||
color palette_pattern = rich_palette(
|
||||
colors=breathe_palette # palette
|
||||
cycle_period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
period=15s # cycle period (defaults: smooth transition, 255 brightness)
|
||||
)
|
||||
|
||||
# Create breathing animation using the palette
|
||||
|
||||
@ -27,7 +27,7 @@ var ornament_colors_ = bytes(
|
||||
# Colorful ornaments as twinkling lights
|
||||
var ornament_pattern_ = animation.rich_palette(engine)
|
||||
ornament_pattern_.colors = ornament_colors_
|
||||
ornament_pattern_.cycle_period = 3000
|
||||
ornament_pattern_.period = 3000
|
||||
ornament_pattern_.transition_type = animation.LINEAR
|
||||
ornament_pattern_.brightness = 255
|
||||
var ornaments_ = animation.twinkle_animation(engine)
|
||||
@ -58,7 +58,7 @@ snow_sparkles_.priority = 15
|
||||
# Garland effect - moving colored lights
|
||||
var garland_pattern_ = animation.rich_palette(engine)
|
||||
garland_pattern_.colors = ornament_colors_
|
||||
garland_pattern_.cycle_period = 2000
|
||||
garland_pattern_.period = 2000
|
||||
garland_pattern_.transition_type = animation.LINEAR
|
||||
garland_pattern_.brightness = 200
|
||||
var garland_ = animation.comet_animation(engine)
|
||||
@ -95,7 +95,7 @@ palette ornament_colors = [
|
||||
]
|
||||
|
||||
# Colorful ornaments as twinkling lights
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color ornament_pattern = rich_palette(colors=ornament_colors, period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation ornaments = twinkle_animation(
|
||||
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(colors=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
|
||||
color garland_pattern = rich_palette(colors=ornament_colors, period=2s, transition_type=LINEAR, brightness=200)
|
||||
animation garland = comet_animation(
|
||||
color=garland_pattern # color source
|
||||
tail_length=6 # garland length (tail length)
|
||||
|
||||
@ -16,7 +16,7 @@ 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_.colors = eye_palette_
|
||||
eye_color_.cycle_period = 0
|
||||
eye_color_.period = 0
|
||||
var cosine_val_ = (def (engine)
|
||||
var provider = animation.cosine_osc(engine)
|
||||
provider.min_value = 0
|
||||
@ -58,7 +58,7 @@ set eye_duration = 5s # duration for a cylon eye cycle
|
||||
|
||||
palette eye_palette = [ red, yellow, green, violet ]
|
||||
|
||||
color eye_color = color_cycle(colors=eye_palette, cycle_period=0)
|
||||
color eye_color = color_cycle(colors=eye_palette, period=0)
|
||||
|
||||
set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
|
||||
set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
|
||||
|
||||
@ -23,10 +23,10 @@ var shutter_size_ = (def (engine)
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.PALETTE_RAINBOW
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.PALETTE_RAINBOW
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
var shutter_animation_ = animation.beacon_animation(engine)
|
||||
shutter_animation_.color = col1_
|
||||
@ -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(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW, period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, period=0)
|
||||
col2.next = 1
|
||||
|
||||
animation shutter_animation = beacon_animation(
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_bidir_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving from left to right
|
||||
var shutter_lr_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -31,10 +31,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving in to out
|
||||
var shutter_inout_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_lr_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving from left to right
|
||||
var shutter_lr_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -25,7 +25,7 @@ var disco_colors_ = bytes(
|
||||
# Fast color cycling base
|
||||
var disco_rich_color_ = animation.rich_palette(engine)
|
||||
disco_rich_color_.colors = disco_colors_
|
||||
disco_rich_color_.cycle_period = 1000
|
||||
disco_rich_color_.period = 1000
|
||||
disco_rich_color_.transition_type = animation.LINEAR
|
||||
disco_rich_color_.brightness = 255
|
||||
var disco_base_ = animation.solid(engine)
|
||||
@ -54,7 +54,7 @@ white_flash_.priority = 20
|
||||
# Add colored sparkles
|
||||
var sparkle_pattern_ = animation.rich_palette(engine)
|
||||
sparkle_pattern_.colors = disco_colors_
|
||||
sparkle_pattern_.cycle_period = 500
|
||||
sparkle_pattern_.period = 500
|
||||
sparkle_pattern_.transition_type = animation.LINEAR
|
||||
sparkle_pattern_.brightness = 255
|
||||
var disco_sparkles_ = animation.twinkle_animation(engine)
|
||||
@ -65,7 +65,7 @@ disco_sparkles_.priority = 15
|
||||
# Add moving pulse for extra effect
|
||||
var pulse_pattern_ = animation.rich_palette(engine)
|
||||
pulse_pattern_.colors = disco_colors_
|
||||
pulse_pattern_.cycle_period = 800
|
||||
pulse_pattern_.period = 800
|
||||
pulse_pattern_.transition_type = animation.LINEAR
|
||||
pulse_pattern_.brightness = 255
|
||||
var disco_pulse_ = animation.beacon_animation(engine)
|
||||
@ -107,7 +107,7 @@ palette disco_colors = [
|
||||
]
|
||||
|
||||
# Fast color cycling base
|
||||
color disco_rich_color = rich_palette(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
color disco_rich_color = rich_palette(colors=disco_colors, period=1s, transition_type=LINEAR, brightness=255)
|
||||
animation disco_base = solid(color=disco_rich_color)
|
||||
|
||||
# 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(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
color sparkle_pattern = rich_palette(colors=disco_colors, period=500ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_sparkles = twinkle_animation(
|
||||
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(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
color pulse_pattern = rich_palette(colors=disco_colors, period=800ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_pulse = beacon_animation(
|
||||
color=pulse_pattern # color source
|
||||
pos=4 # initial position
|
||||
|
||||
@ -23,7 +23,7 @@ var fire_colors_ = bytes(
|
||||
# Create base fire animation with palette
|
||||
var fire_base_color_ = animation.rich_palette(engine)
|
||||
fire_base_color_.colors = fire_colors_
|
||||
fire_base_color_.cycle_period = 3000
|
||||
fire_base_color_.period = 3000
|
||||
fire_base_color_.transition_type = animation.LINEAR
|
||||
fire_base_color_.brightness = 255
|
||||
var fire_base_ = animation.solid(engine)
|
||||
@ -39,7 +39,7 @@ end)(engine)
|
||||
# Add subtle position variation for more realism
|
||||
var flicker_pattern_ = animation.rich_palette(engine)
|
||||
flicker_pattern_.colors = fire_colors_
|
||||
flicker_pattern_.cycle_period = 2000
|
||||
flicker_pattern_.period = 2000
|
||||
flicker_pattern_.transition_type = animation.LINEAR
|
||||
flicker_pattern_.brightness = 255
|
||||
var fire_flicker_ = animation.twinkle_animation(engine)
|
||||
@ -69,14 +69,14 @@ palette fire_colors = [
|
||||
]
|
||||
|
||||
# Create base fire animation with palette
|
||||
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color fire_base_color = rich_palette(colors=fire_colors, period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_base = solid(color=fire_base_color)
|
||||
|
||||
# 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(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color flicker_pattern = rich_palette(colors=fire_colors, period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_flicker = twinkle_animation(
|
||||
color=flicker_pattern # color source
|
||||
density=12 # density (number of flickers)
|
||||
|
||||
@ -23,13 +23,13 @@ var lava_colors_ = bytes(
|
||||
# Base lava animation - very slow color changes
|
||||
var lava_base_ = animation.rich_palette_animation(engine)
|
||||
lava_base_.colors = lava_colors_
|
||||
lava_base_.cycle_period = 15000
|
||||
lava_base_.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_.colors = lava_colors_
|
||||
blob1_pattern_.cycle_period = 12000
|
||||
blob1_pattern_.period = 12000
|
||||
blob1_pattern_.transition_type = animation.SINE
|
||||
blob1_pattern_.brightness = 255
|
||||
var lava_blob1_ = animation.beacon_animation(engine)
|
||||
@ -47,7 +47,7 @@ lava_blob1_.pos = (def (engine)
|
||||
end)(engine) # Very slow movement
|
||||
var blob2_pattern_ = animation.rich_palette(engine)
|
||||
blob2_pattern_.colors = lava_colors_
|
||||
blob2_pattern_.cycle_period = 10000
|
||||
blob2_pattern_.period = 10000
|
||||
blob2_pattern_.transition_type = animation.SINE
|
||||
blob2_pattern_.brightness = 220
|
||||
var lava_blob2_ = animation.beacon_animation(engine)
|
||||
@ -65,7 +65,7 @@ lava_blob2_.pos = (def (engine)
|
||||
end)(engine) # Opposite direction, slower
|
||||
var blob3_pattern_ = animation.rich_palette(engine)
|
||||
blob3_pattern_.colors = lava_colors_
|
||||
blob3_pattern_.cycle_period = 8000
|
||||
blob3_pattern_.period = 8000
|
||||
blob3_pattern_.transition_type = animation.SINE
|
||||
blob3_pattern_.brightness = 200
|
||||
var lava_blob3_ = animation.beacon_animation(engine)
|
||||
@ -84,7 +84,7 @@ end)(engine) # Small movement range
|
||||
# Add subtle heat shimmer effect
|
||||
var shimmer_pattern_ = animation.rich_palette(engine)
|
||||
shimmer_pattern_.colors = lava_colors_
|
||||
shimmer_pattern_.cycle_period = 6000
|
||||
shimmer_pattern_.period = 6000
|
||||
shimmer_pattern_.transition_type = animation.SINE
|
||||
shimmer_pattern_.brightness = 255
|
||||
var heat_shimmer_ = animation.twinkle_animation(engine)
|
||||
@ -117,10 +117,10 @@ palette lava_colors = [
|
||||
]
|
||||
|
||||
# Base lava animation - very slow color changes
|
||||
animation lava_base = rich_palette_animation(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
animation lava_base = rich_palette_animation(colors=lava_colors, period=15s, transition_type=SINE, brightness=180)
|
||||
|
||||
# Add slow-moving lava blobs
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, period=12s, transition_type=SINE, brightness=255)
|
||||
animation lava_blob1 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
color blob2_pattern = rich_palette(colors=lava_colors, period=10s, transition_type=SINE, brightness=220)
|
||||
animation lava_blob2 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
color blob3_pattern = rich_palette(colors=lava_colors, period=8s, transition_type=SINE, brightness=200)
|
||||
animation lava_blob3 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color shimmer_pattern = rich_palette(colors=lava_colors, period=6s, transition_type=SINE, brightness=255)
|
||||
animation heat_shimmer = twinkle_animation(
|
||||
color=shimmer_pattern # color source
|
||||
density=6 # density (shimmer points)
|
||||
|
||||
@ -20,7 +20,7 @@ var storm_colors_ = bytes(
|
||||
)
|
||||
var storm_bg_ = animation.rich_palette_animation(engine)
|
||||
storm_bg_.colors = storm_colors_
|
||||
storm_bg_.cycle_period = 12000
|
||||
storm_bg_.period = 12000
|
||||
storm_bg_.transition_type = animation.SINE
|
||||
storm_bg_.brightness = 100
|
||||
# Random lightning flashes - full strip
|
||||
@ -92,7 +92,7 @@ palette storm_colors = [
|
||||
(255, 0x220033) # Slightly lighter purple
|
||||
]
|
||||
|
||||
animation storm_bg = rich_palette_animation(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
animation storm_bg = rich_palette_animation(colors=storm_colors, period=12s, transition_type=SINE, brightness=100)
|
||||
|
||||
# Random lightning flashes - full strip
|
||||
animation lightning_main = solid(color=0xFFFFFF) # Bright white
|
||||
|
||||
@ -28,7 +28,7 @@ var matrix_greens_ = bytes(
|
||||
# Create multiple cascading streams
|
||||
var stream1_pattern_ = animation.rich_palette(engine)
|
||||
stream1_pattern_.colors = matrix_greens_
|
||||
stream1_pattern_.cycle_period = 2000
|
||||
stream1_pattern_.period = 2000
|
||||
stream1_pattern_.transition_type = animation.LINEAR
|
||||
stream1_pattern_.brightness = 255
|
||||
var stream1_ = animation.comet_animation(engine)
|
||||
@ -38,7 +38,7 @@ stream1_.speed = 1500 # speed
|
||||
stream1_.priority = 10
|
||||
var stream2_pattern_ = animation.rich_palette(engine)
|
||||
stream2_pattern_.colors = matrix_greens_
|
||||
stream2_pattern_.cycle_period = 1800
|
||||
stream2_pattern_.period = 1800
|
||||
stream2_pattern_.transition_type = animation.LINEAR
|
||||
stream2_pattern_.brightness = 200
|
||||
var stream2_ = animation.comet_animation(engine)
|
||||
@ -48,7 +48,7 @@ stream2_.speed = 2200 # different speed
|
||||
stream2_.priority = 8
|
||||
var stream3_pattern_ = animation.rich_palette(engine)
|
||||
stream3_pattern_.colors = matrix_greens_
|
||||
stream3_pattern_.cycle_period = 2500
|
||||
stream3_pattern_.period = 2500
|
||||
stream3_pattern_.transition_type = animation.LINEAR
|
||||
stream3_pattern_.brightness = 180
|
||||
var stream3_ = animation.comet_animation(engine)
|
||||
@ -91,7 +91,7 @@ palette matrix_greens = [
|
||||
]
|
||||
|
||||
# Create multiple cascading streams
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation stream1 = comet_animation(
|
||||
color=stream1_pattern # color source
|
||||
tail_length=15 # long tail
|
||||
@ -100,7 +100,7 @@ animation stream1 = comet_animation(
|
||||
)
|
||||
|
||||
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
animation stream2 = comet_animation(
|
||||
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(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
color stream3_pattern = rich_palette(colors=matrix_greens, period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
animation stream3 = comet_animation(
|
||||
color=stream3_pattern # color source
|
||||
tail_length=10 # shorter tail
|
||||
|
||||
@ -22,7 +22,7 @@ var neon_colors_ = bytes(
|
||||
# Main neon glow with color cycling
|
||||
var neon_main_ = animation.rich_palette_animation(engine)
|
||||
neon_main_.colors = neon_colors_
|
||||
neon_main_.cycle_period = 4000
|
||||
neon_main_.period = 4000
|
||||
neon_main_.transition_type = animation.LINEAR
|
||||
neon_main_.brightness = 255
|
||||
# Add electrical flickering
|
||||
@ -49,7 +49,7 @@ neon_surge_.priority = 20
|
||||
# Add neon tube segments with gaps
|
||||
var segment_pattern_ = animation.rich_palette(engine)
|
||||
segment_pattern_.colors = neon_colors_
|
||||
segment_pattern_.cycle_period = 4000
|
||||
segment_pattern_.period = 4000
|
||||
segment_pattern_.transition_type = animation.LINEAR
|
||||
segment_pattern_.brightness = 255
|
||||
var segment1_ = animation.beacon_animation(engine)
|
||||
@ -101,7 +101,7 @@ palette neon_colors = [
|
||||
]
|
||||
|
||||
# Main neon glow with color cycling
|
||||
animation neon_main = rich_palette_animation(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation neon_main = rich_palette_animation(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
|
||||
|
||||
# Add electrical flickering
|
||||
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(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
color segment_pattern = rich_palette(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation segment1 = beacon_animation(
|
||||
color=segment_pattern # color source
|
||||
pos=6 # position
|
||||
|
||||
@ -23,13 +23,13 @@ var ocean_colors_ = bytes(
|
||||
# Base ocean animation with slow color cycling
|
||||
var ocean_base_ = animation.rich_palette_animation(engine)
|
||||
ocean_base_.colors = ocean_colors_
|
||||
ocean_base_.cycle_period = 8000
|
||||
ocean_base_.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_.colors = ocean_colors_
|
||||
wave1_pattern_.cycle_period = 6000
|
||||
wave1_pattern_.period = 6000
|
||||
wave1_pattern_.transition_type = animation.SINE
|
||||
wave1_pattern_.brightness = 255
|
||||
var wave1_ = animation.beacon_animation(engine)
|
||||
@ -47,7 +47,7 @@ wave1_.pos = (def (engine)
|
||||
end)(engine) # 60-12 = 48
|
||||
var wave2_pattern_ = animation.rich_palette(engine)
|
||||
wave2_pattern_.colors = ocean_colors_
|
||||
wave2_pattern_.cycle_period = 4000
|
||||
wave2_pattern_.period = 4000
|
||||
wave2_pattern_.transition_type = animation.SINE
|
||||
wave2_pattern_.brightness = 180
|
||||
var wave2_ = animation.beacon_animation(engine)
|
||||
@ -93,10 +93,10 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Base ocean animation with slow color cycling
|
||||
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_base = rich_palette_animation(colors=ocean_colors, period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add wave motion with moving pulses
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, period=6s, transition_type=SINE, brightness=255)
|
||||
animation wave1 = beacon_animation(
|
||||
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(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=ocean_colors, period=4s, transition_type=SINE, brightness=180)
|
||||
animation wave2 = beacon_animation(
|
||||
color=wave2_pattern # color source
|
||||
pos=52 # initial position
|
||||
|
||||
@ -25,10 +25,10 @@ var ocean_colors_ = bytes(
|
||||
# Create animations using the palettes
|
||||
var fire_anim_ = animation.rich_palette_animation(engine)
|
||||
fire_anim_.colors = fire_colors_
|
||||
fire_anim_.cycle_period = 5000
|
||||
fire_anim_.period = 5000
|
||||
var ocean_anim_ = animation.rich_palette_animation(engine)
|
||||
ocean_anim_.colors = ocean_colors_
|
||||
ocean_anim_.cycle_period = 8000
|
||||
ocean_anim_.period = 8000
|
||||
# Sequence to show both palettes
|
||||
var palette_demo_ = animation.sequence_manager(engine)
|
||||
.push_play_step(fire_anim_, 10000)
|
||||
@ -62,9 +62,9 @@ palette ocean_colors = [
|
||||
]
|
||||
|
||||
# Create animations using the palettes
|
||||
animation fire_anim = rich_palette_animation(colors=fire_colors, cycle_period=5s)
|
||||
animation fire_anim = rich_palette_animation(colors=fire_colors, period=5s)
|
||||
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s)
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, period=8s)
|
||||
|
||||
# Sequence to show both palettes
|
||||
sequence palette_demo {
|
||||
|
||||
@ -53,22 +53,22 @@ var fire_effect_ = animation.solid(engine)
|
||||
fire_effect_.color = (def (engine)
|
||||
var provider = animation.rich_palette(engine)
|
||||
provider.colors = fire_gradient_
|
||||
provider.cycle_period = 3000
|
||||
provider.period = 3000
|
||||
return provider
|
||||
end)(engine)
|
||||
var ocean_waves_ = animation.rich_palette_animation(engine)
|
||||
ocean_waves_.colors = ocean_depths_
|
||||
ocean_waves_.cycle_period = 8000
|
||||
ocean_waves_.period = 8000
|
||||
ocean_waves_.transition_type = animation.SINE
|
||||
ocean_waves_.brightness = 200
|
||||
var aurora_lights_ = animation.rich_palette_animation(engine)
|
||||
aurora_lights_.colors = aurora_borealis_
|
||||
aurora_lights_.cycle_period = 12000
|
||||
aurora_lights_.period = 12000
|
||||
aurora_lights_.transition_type = animation.SINE
|
||||
aurora_lights_.brightness = 180
|
||||
var sunset_glow_ = animation.rich_palette_animation(engine)
|
||||
sunset_glow_.colors = sunset_sky_
|
||||
sunset_glow_.cycle_period = 6000
|
||||
sunset_glow_.period = 6000
|
||||
sunset_glow_.transition_type = animation.SINE
|
||||
sunset_glow_.brightness = 220
|
||||
# Sequence to showcase all palettes
|
||||
@ -143,13 +143,13 @@ palette sunset_sky = [
|
||||
]
|
||||
|
||||
# Create animations using each palette
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s))
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, period=3s))
|
||||
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, period=12s, transition_type=SINE, brightness=180)
|
||||
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, period=6s, transition_type=SINE, brightness=220)
|
||||
|
||||
# Sequence to showcase all palettes
|
||||
sequence palette_showcase {
|
||||
|
||||
@ -24,13 +24,13 @@ var plasma_colors_ = bytes(
|
||||
# Base plasma animation with medium speed
|
||||
var plasma_base_ = animation.rich_palette_animation(engine)
|
||||
plasma_base_.colors = plasma_colors_
|
||||
plasma_base_.cycle_period = 6000
|
||||
plasma_base_.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_.colors = plasma_colors_
|
||||
wave1_pattern_.cycle_period = 4000
|
||||
wave1_pattern_.period = 4000
|
||||
wave1_pattern_.transition_type = animation.SINE
|
||||
wave1_pattern_.brightness = 255
|
||||
var plasma_wave1_ = animation.beacon_animation(engine)
|
||||
@ -48,7 +48,7 @@ plasma_wave1_.pos = (def (engine)
|
||||
end)(engine)
|
||||
var wave2_pattern_ = animation.rich_palette(engine)
|
||||
wave2_pattern_.colors = plasma_colors_
|
||||
wave2_pattern_.cycle_period = 5000
|
||||
wave2_pattern_.period = 5000
|
||||
wave2_pattern_.transition_type = animation.SINE
|
||||
wave2_pattern_.brightness = 180
|
||||
var plasma_wave2_ = animation.beacon_animation(engine)
|
||||
@ -66,7 +66,7 @@ plasma_wave2_.pos = (def (engine)
|
||||
end)(engine) # Opposite direction
|
||||
var wave3_pattern_ = animation.rich_palette(engine)
|
||||
wave3_pattern_.colors = plasma_colors_
|
||||
wave3_pattern_.cycle_period = 3000
|
||||
wave3_pattern_.period = 3000
|
||||
wave3_pattern_.transition_type = animation.SINE
|
||||
wave3_pattern_.brightness = 220
|
||||
var plasma_wave3_ = animation.beacon_animation(engine)
|
||||
@ -115,10 +115,10 @@ palette plasma_colors = [
|
||||
]
|
||||
|
||||
# Base plasma animation with medium speed
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, period=6s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add multiple wave layers for complexity
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, period=4s, transition_type=SINE, brightness=255)
|
||||
animation plasma_wave1 = beacon_animation(
|
||||
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(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=plasma_colors, period=5s, transition_type=SINE, brightness=180)
|
||||
animation plasma_wave2 = beacon_animation(
|
||||
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(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
color wave3_pattern = rich_palette(colors=plasma_colors, period=3s, transition_type=SINE, brightness=220)
|
||||
animation plasma_wave3 = beacon_animation(
|
||||
color=wave3_pattern # color source
|
||||
pos=20 # initial position
|
||||
|
||||
@ -16,7 +16,7 @@ var rainbow_palette_ = bytes("FFFF0000" "FFFF8000" "FFFFFF00" "FF00FF00" "FF0000
|
||||
# Create smooth rainbow cycle animation
|
||||
var rainbow_cycle_ = animation.color_cycle(engine)
|
||||
rainbow_cycle_.colors = rainbow_palette_
|
||||
rainbow_cycle_.cycle_period = 5000 # cycle period
|
||||
rainbow_cycle_.period = 5000 # cycle period
|
||||
var rainbow_animation_ = animation.solid(engine)
|
||||
rainbow_animation_.color = rainbow_cycle_
|
||||
# Start the animation
|
||||
@ -35,7 +35,7 @@ palette rainbow_palette = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8
|
||||
# Create smooth rainbow cycle animation
|
||||
color rainbow_cycle = color_cycle(
|
||||
colors=rainbow_palette
|
||||
cycle_period=5s # cycle period
|
||||
period=5s # cycle period
|
||||
)
|
||||
animation rainbow_animation = solid(color=rainbow_cycle)
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ var brightness_low_ = 64
|
||||
var eye_palette_ = bytes("FFFF0000" "FFFFFF00" "FF008000" "FFEE82EE")
|
||||
var eye_color_ = animation.color_cycle(engine)
|
||||
eye_color_.colors = eye_palette_
|
||||
eye_color_.cycle_period = 0
|
||||
eye_color_.period = 0
|
||||
# Create animations
|
||||
var red_eye_ = animation.beacon_animation(engine)
|
||||
red_eye_.color = eye_color_
|
||||
@ -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(colors=eye_palette, cycle_period=0)
|
||||
color eye_color = color_cycle(colors=eye_palette, period=0)
|
||||
|
||||
# Create animations
|
||||
animation red_eye = beacon_animation(
|
||||
|
||||
@ -17,7 +17,7 @@ var rainbow_ = bytes("00FF0000" "40FFA500" "80FFFF00" "C0008000" "FF0000FF")
|
||||
# Create an animation using the palette
|
||||
var rainbow_cycle_ = animation.rich_palette_animation(engine)
|
||||
rainbow_cycle_.colors = rainbow_
|
||||
rainbow_cycle_.cycle_period = 3000
|
||||
rainbow_cycle_.period = 3000
|
||||
# Simple sequence
|
||||
var demo_ = animation.sequence_manager(engine)
|
||||
.push_play_step(rainbow_cycle_, 15000)
|
||||
@ -41,7 +41,7 @@ palette rainbow = [
|
||||
]
|
||||
|
||||
# Create an animation using the palette
|
||||
animation rainbow_cycle = rich_palette_animation(colors=rainbow, cycle_period=3s)
|
||||
animation rainbow_cycle = rich_palette_animation(colors=rainbow, period=3s)
|
||||
|
||||
# Simple sequence
|
||||
sequence demo {
|
||||
|
||||
@ -27,7 +27,7 @@ var daylight_colors_ = bytes(
|
||||
# Main daylight cycle - very slow transition
|
||||
var daylight_cycle_ = animation.rich_palette_animation(engine)
|
||||
daylight_cycle_.colors = daylight_colors_
|
||||
daylight_cycle_.cycle_period = 60000
|
||||
daylight_cycle_.period = 60000
|
||||
# Add sun position effect - bright spot that moves
|
||||
var sun_position_ = animation.beacon_animation(engine)
|
||||
sun_position_.color = 0xFFFFFFAA # Bright yellow sun
|
||||
@ -111,7 +111,7 @@ palette daylight_colors = [
|
||||
]
|
||||
|
||||
# Main daylight cycle - very slow transition
|
||||
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, cycle_period=60s)
|
||||
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, period=60s)
|
||||
|
||||
# Add sun position effect - bright spot that moves
|
||||
animation sun_position = beacon_animation(
|
||||
|
||||
@ -14,7 +14,7 @@ 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_.colors = palette_olivary_
|
||||
olivary_.cycle_period = 0
|
||||
olivary_.period = 0
|
||||
var swipe_animation_ = animation.solid(engine)
|
||||
swipe_animation_.color = olivary_
|
||||
var slide_colors_ = animation.sequence_manager(engine)
|
||||
@ -40,7 +40,7 @@ palette palette_olivary = [
|
||||
white
|
||||
]
|
||||
|
||||
color olivary = color_cycle(colors=palette_olivary, cycle_period=0)
|
||||
color olivary = color_cycle(colors=palette_olivary, period=0)
|
||||
|
||||
animation swipe_animation = solid(
|
||||
color = olivary
|
||||
|
||||
@ -22,7 +22,7 @@ class rainbow_pulse_animation : animation.engine_proxy
|
||||
|
||||
var cycle_color_ = animation.color_cycle(engine)
|
||||
cycle_color_.colors = animation.create_closure_value(engine, def (engine) return self.pal1 end)
|
||||
cycle_color_.cycle_period = animation.create_closure_value(engine, def (engine) return self.period end)
|
||||
cycle_color_.period = animation.create_closure_value(engine, def (engine) return self.period end)
|
||||
# Create pulsing animation
|
||||
var pulse_ = animation.pulsating_animation(engine)
|
||||
pulse_.color = cycle_color_
|
||||
@ -68,7 +68,7 @@ template animation rainbow_pulse {
|
||||
param back_color type color
|
||||
|
||||
# Create color cycle using first palette
|
||||
color cycle_color = color_cycle(colors=pal1, cycle_period=period)
|
||||
color cycle_color = color_cycle(colors=pal1, period=period)
|
||||
|
||||
# Create pulsing animation
|
||||
animation pulse = pulsating_animation(
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_bidir_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving from left to right
|
||||
var shutter_lr_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving from left to right
|
||||
var shutter_central_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving from left to right
|
||||
|
||||
@ -30,10 +30,10 @@ class shutter_central_animation : animation.engine_proxy
|
||||
end)(engine)
|
||||
var col1_ = animation.color_cycle(engine)
|
||||
col1_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col1_.cycle_period = 0
|
||||
col1_.period = 0
|
||||
var col2_ = animation.color_cycle(engine)
|
||||
col2_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col2_.cycle_period = 0
|
||||
col2_.period = 0
|
||||
col2_.next = 1
|
||||
# shutter moving in to out
|
||||
var shutter_inout_animation_ = animation.beacon_animation(engine)
|
||||
@ -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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=eye_palette, cycle_period=0)
|
||||
color eye_color = color_cycle(colors=eye_palette, period=0)
|
||||
|
||||
set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
|
||||
set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = eye_duration)
|
||||
|
||||
@ -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(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW, period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
|
||||
color disco_rich_color = rich_palette(colors=disco_colors, period=1s, transition_type=LINEAR, brightness=255)
|
||||
animation disco_base = solid(color=disco_rich_color)
|
||||
|
||||
# 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(colors=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
|
||||
color sparkle_pattern = rich_palette(colors=disco_colors, period=500ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_sparkles = twinkle_animation(
|
||||
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(colors=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
|
||||
color pulse_pattern = rich_palette(colors=disco_colors, period=800ms, transition_type=LINEAR, brightness=255)
|
||||
animation disco_pulse = beacon_animation(
|
||||
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(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
||||
color fire_base_color = rich_palette(colors=fire_colors, period=3s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_base = solid(color=fire_base_color)
|
||||
|
||||
# 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(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color flicker_pattern = rich_palette(colors=fire_colors, period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation fire_flicker = twinkle_animation(
|
||||
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(colors=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
||||
animation lava_base = rich_palette_animation(colors=lava_colors, period=15s, transition_type=SINE, brightness=180)
|
||||
|
||||
# Add slow-moving lava blobs
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
||||
color blob1_pattern = rich_palette(colors=lava_colors, period=12s, transition_type=SINE, brightness=255)
|
||||
animation lava_blob1 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
||||
color blob2_pattern = rich_palette(colors=lava_colors, period=10s, transition_type=SINE, brightness=220)
|
||||
animation lava_blob2 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
color blob3_pattern = rich_palette(colors=lava_colors, period=8s, transition_type=SINE, brightness=200)
|
||||
animation lava_blob3 = beacon_animation(
|
||||
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(colors=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color shimmer_pattern = rich_palette(colors=lava_colors, period=6s, transition_type=SINE, brightness=255)
|
||||
animation heat_shimmer = twinkle_animation(
|
||||
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(colors=storm_colors, cycle_period=12s, transition_type=SINE, brightness=100)
|
||||
animation storm_bg = rich_palette_animation(colors=storm_colors, period=12s, transition_type=SINE, brightness=100)
|
||||
|
||||
# Random lightning flashes - full strip
|
||||
animation lightning_main = solid(color=0xFFFFFF) # Bright white
|
||||
|
||||
@ -17,7 +17,7 @@ palette matrix_greens = [
|
||||
]
|
||||
|
||||
# Create multiple cascading streams
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
||||
color stream1_pattern = rich_palette(colors=matrix_greens, period=2s, transition_type=LINEAR, brightness=255)
|
||||
animation stream1 = comet_animation(
|
||||
color=stream1_pattern # color source
|
||||
tail_length=15 # long tail
|
||||
@ -26,7 +26,7 @@ animation stream1 = comet_animation(
|
||||
)
|
||||
|
||||
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
color stream2_pattern = rich_palette(colors=matrix_greens, period=1.8s, transition_type=LINEAR, brightness=200)
|
||||
animation stream2 = comet_animation(
|
||||
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(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
color stream3_pattern = rich_palette(colors=matrix_greens, period=2.5s, transition_type=LINEAR, brightness=180)
|
||||
animation stream3 = comet_animation(
|
||||
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(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation neon_main = rich_palette_animation(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
|
||||
|
||||
# Add electrical flickering
|
||||
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(colors=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
|
||||
color segment_pattern = rich_palette(colors=neon_colors, period=4s, transition_type=LINEAR, brightness=255)
|
||||
animation segment1 = beacon_animation(
|
||||
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(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_base = rich_palette_animation(colors=ocean_colors, period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add wave motion with moving pulses
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=ocean_colors, period=6s, transition_type=SINE, brightness=255)
|
||||
animation wave1 = beacon_animation(
|
||||
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(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=ocean_colors, period=4s, transition_type=SINE, brightness=180)
|
||||
animation wave2 = beacon_animation(
|
||||
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(colors=fire_colors, cycle_period=5s)
|
||||
animation fire_anim = rich_palette_animation(colors=fire_colors, period=5s)
|
||||
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, cycle_period=8s)
|
||||
animation ocean_anim = rich_palette_animation(colors=ocean_colors, period=8s)
|
||||
|
||||
# Sequence to show both palettes
|
||||
sequence palette_demo {
|
||||
|
||||
@ -44,13 +44,13 @@ palette sunset_sky = [
|
||||
]
|
||||
|
||||
# Create animations using each palette
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, cycle_period=3s))
|
||||
animation fire_effect = solid(color=rich_palette(colors=fire_gradient, period=3s))
|
||||
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, cycle_period=8s, transition_type=SINE, brightness=200)
|
||||
animation ocean_waves = rich_palette_animation(colors=ocean_depths, period=8s, transition_type=SINE, brightness=200)
|
||||
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, cycle_period=12s, transition_type=SINE, brightness=180)
|
||||
animation aurora_lights = rich_palette_animation(colors=aurora_borealis, period=12s, transition_type=SINE, brightness=180)
|
||||
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, cycle_period=6s, transition_type=SINE, brightness=220)
|
||||
animation sunset_glow = rich_palette_animation(colors=sunset_sky, period=6s, transition_type=SINE, brightness=220)
|
||||
|
||||
# Sequence to showcase all palettes
|
||||
sequence palette_showcase {
|
||||
|
||||
@ -14,10 +14,10 @@ palette plasma_colors = [
|
||||
]
|
||||
|
||||
# Base plasma animation with medium speed
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, cycle_period=6s, transition_type=SINE, brightness=200)
|
||||
animation plasma_base = rich_palette_animation(colors=plasma_colors, period=6s, transition_type=SINE, brightness=200)
|
||||
|
||||
# Add multiple wave layers for complexity
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, cycle_period=4s, transition_type=SINE, brightness=255)
|
||||
color wave1_pattern = rich_palette(colors=plasma_colors, period=4s, transition_type=SINE, brightness=255)
|
||||
animation plasma_wave1 = beacon_animation(
|
||||
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(colors=plasma_colors, cycle_period=5s, transition_type=SINE, brightness=180)
|
||||
color wave2_pattern = rich_palette(colors=plasma_colors, period=5s, transition_type=SINE, brightness=180)
|
||||
animation plasma_wave2 = beacon_animation(
|
||||
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(colors=plasma_colors, cycle_period=3s, transition_type=SINE, brightness=220)
|
||||
color wave3_pattern = rich_palette(colors=plasma_colors, period=3s, transition_type=SINE, brightness=220)
|
||||
animation plasma_wave3 = beacon_animation(
|
||||
color=wave3_pattern # color source
|
||||
pos=20 # initial position
|
||||
|
||||
@ -8,7 +8,7 @@ palette rainbow_palette = [0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00, 0x0000FF, 0x8
|
||||
# Create smooth rainbow cycle animation
|
||||
color rainbow_cycle = color_cycle(
|
||||
colors=rainbow_palette
|
||||
cycle_period=5s # cycle period
|
||||
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(colors=eye_palette, cycle_period=0)
|
||||
color eye_color = color_cycle(colors=eye_palette, 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(colors=rainbow, cycle_period=3s)
|
||||
animation rainbow_cycle = rich_palette_animation(colors=rainbow, 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(colors=daylight_colors, cycle_period=60s)
|
||||
animation daylight_cycle = rich_palette_animation(colors=daylight_colors, period=60s)
|
||||
|
||||
# Add sun position effect - bright spot that moves
|
||||
animation sun_position = beacon_animation(
|
||||
|
||||
@ -13,7 +13,7 @@ palette palette_olivary = [
|
||||
white
|
||||
]
|
||||
|
||||
color olivary = color_cycle(colors=palette_olivary, cycle_period=0)
|
||||
color olivary = color_cycle(colors=palette_olivary, 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(colors=pal1, cycle_period=period)
|
||||
color cycle_color = color_cycle(colors=pal1, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1
|
||||
|
||||
# shutter moving in to out
|
||||
|
||||
@ -3,6 +3,6 @@
|
||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||
# PALETTE_RAINBOW defines 7 rainbow colors at roughly the same brightness
|
||||
# PALETTE_RAINBOW_W adds 8th color white
|
||||
color rainbow_color = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=5s)
|
||||
color rainbow_color = color_cycle(colors=PALETTE_RAINBOW_W, period=5s)
|
||||
animation back = solid(color=rainbow_color)
|
||||
run back
|
||||
@ -14,7 +14,7 @@ palette rainbow_with_white = [
|
||||
]
|
||||
|
||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||
color rainbow_color = color_cycle(colors=rainbow_with_white, cycle_period=5s)
|
||||
color rainbow_color = color_cycle(colors=rainbow_with_white, period=5s)
|
||||
|
||||
# Define a solid background with this dynamic color
|
||||
animation back = solid(color=rainbow_color)
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
animation back = rich_palette_animation()
|
||||
# Equivalent to
|
||||
# animation back = rich_palette_animation(colors=PALETTE_PALETTE_RAINBOW, cycle_period=5s,
|
||||
# animation back = rich_palette_animation(colors=PALETTE_PALETTE_RAINBOW, period=5s,
|
||||
# transition_type=SINE, brightness=100%)
|
||||
run back
|
||||
@ -15,7 +15,7 @@ palette rainbow_with_white = [
|
||||
]
|
||||
|
||||
# Define a color attribute that cycles over time, cycle is 10 seconds
|
||||
color rainbow_color_rollover = rich_palette(cycle_period=10s)
|
||||
color rainbow_color_rollover = rich_palette(period=10s)
|
||||
|
||||
# Use the dynamic color in a simple 'solid' animation
|
||||
animation back = solid(color=rainbow_color_rollover)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# @desc Rainbow pattern
|
||||
|
||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
# 'period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
|
||||
|
||||
# Define a gradient across the whole strip
|
||||
animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color)
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
# 'period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
|
||||
|
||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
||||
set strip_len = strip_length()
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# @desc Rainbow gradient with oscillating spatial period between 100% and 50%
|
||||
|
||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
# 'period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
|
||||
|
||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
||||
set strip_len = strip_length()
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
# @desc Rainbow gradient rotating along the strip over 5 seconds
|
||||
|
||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
# 'period = 0' means that the colors don't change in time, only spatial change
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
|
||||
|
||||
# define a gradient across the whole strip
|
||||
animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s)
|
||||
|
||||
@ -13,7 +13,7 @@ palette vue_meter_palette = [
|
||||
]
|
||||
|
||||
# Define a color palette pattern for 'vue_meter_palette'
|
||||
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
||||
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, period=0, transition_type=LINEAR)
|
||||
|
||||
# Define a sawtooth value from 0% to 100%
|
||||
set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s)
|
||||
|
||||
@ -24,7 +24,7 @@ palette vue_meter_palette = [
|
||||
]
|
||||
|
||||
# Define a color palette pattern for 'vue_meter_palette'
|
||||
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
||||
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, period=0, transition_type=LINEAR)
|
||||
|
||||
# Define a vue-meter based on all elements above
|
||||
animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter())
|
||||
|
||||
@ -16,7 +16,7 @@ run stars
|
||||
|
||||
# We can combine a dynamic 'pos' value with a dynamic 'color'
|
||||
animation back = beacon_animation(
|
||||
color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s)
|
||||
color = rich_palette(colors=PALETTE_RAINBOW_W2, period=5s)
|
||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
||||
beacon_size = 3 # small 3 pixels eye
|
||||
slew_size = 2 # with 2 pixel shading around
|
||||
|
||||
@ -12,8 +12,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
||||
|
||||
# Define 2 color providers cycling through palette rainbow with white
|
||||
# 'col2' is shifted by 1 color from 'col1'
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||
|
||||
# Using beacon_animation to move a shutter from left to right
|
||||
|
||||
@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
||||
|
||||
# Define 2 color providers cycling through palette rainbow with white
|
||||
# 'col2' is shifted by 1 color from 'col1'
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||
|
||||
# Using beacon_animation to move a shutter from in to out
|
||||
|
||||
@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
||||
|
||||
# Define 2 color providers cycling through palette rainbow with white
|
||||
# 'col2' is shifted by 1 color from 'col1'
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, period=0)
|
||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||
|
||||
# Using beacon_animation to move a shutter from in to out
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# @desc Crenel static with variable color
|
||||
|
||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||
color rainbow_color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s)
|
||||
color rainbow_color = rich_palette(colors=PALETTE_RAINBOW_W2, period=5s)
|
||||
|
||||
# Define a simple crenel 2+2
|
||||
animation back = crenel_animation(
|
||||
|
||||
@ -13,7 +13,7 @@ animation mask = crenel_animation(
|
||||
)
|
||||
|
||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, period=0)
|
||||
# Define a gradient across the whole strip and use crenel as opacity mask
|
||||
animation pattern = palette_gradient_animation(
|
||||
color_source = rainbow_rich_color # use the rainow pattern
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# @desc Template example fir Cylon-style scanning eye
|
||||
# @desc Template example for Cylon-style scanning eye
|
||||
|
||||
# Define a full template with parameters: eye_color, back_color, period, priority
|
||||
template animation cylon_eye {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
# @desc Rainbow colors cycling with custom palette
|
||||
|
||||
# Define a full template with parameters: colors, cycle_period
|
||||
# Define a full template with parameters: colors, period
|
||||
template animation color_cycle2 {
|
||||
param colors type palette
|
||||
param cycle_period default 5s
|
||||
param period default 5s
|
||||
|
||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||
color rainbow_color = color_cycle(colors=colors, cycle_period=cycle_period)
|
||||
color rainbow_color = color_cycle(colors=colors, period=period)
|
||||
|
||||
# Define a solid background with this dynamic color
|
||||
animation back = solid(color=rainbow_color)
|
||||
@ -19,5 +19,5 @@ palette rgb = [
|
||||
0x0080FF # Blue
|
||||
]
|
||||
|
||||
animation main = color_cycle2(colors = rgb, cycle_period = 2s)
|
||||
animation main = color_cycle2(colors = rgb, period = 2s)
|
||||
run main
|
||||
@ -15,8 +15,8 @@ template animation shutter_bidir {
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||
|
||||
# Define two rotating palettes, shifted by one color
|
||||
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||
color col1 = color_cycle(colors=colors, period=0)
|
||||
color col2 = color_cycle(colors=colors, period=0)
|
||||
col2.next = 1 # move 'col2' to the next color so it's shifte by one compared to 'col1'
|
||||
|
||||
# Shutter moving in in-out
|
||||
|
||||
@ -175,7 +175,7 @@ template animation fade_effect {
|
||||
# 'duration' is implicit - no need to declare
|
||||
set oscillator = sawtooth(min_value=0, max_value=255, duration=duration)
|
||||
|
||||
color col = color_cycle(palette=colors, cycle_period=0)
|
||||
color col = color_cycle(colors=colors, period=0)
|
||||
animation test = solid(color=col)
|
||||
test.opacity = oscillator # 'opacity' is also implicit
|
||||
|
||||
@ -386,35 +386,35 @@ Cycles through a palette of colors with brutal switching. Inherits from `ColorPr
|
||||
|
||||
| Parameter | Type | Default | Constraints | Description |
|
||||
|-----------|------|---------|-------------|-------------|
|
||||
| `palette` | bytes | default palette | - | Palette bytes in AARRGGBB format |
|
||||
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = manual only) |
|
||||
| `colors` | bytes | default palette | - | Palette bytes in AARRGGBB format |
|
||||
| `period` | int | 5000 | min: 0 | Cycle time in ms (0 = manual only) |
|
||||
| `next` | int | 0 | - | Write 1 to move to next color manually, or any number to go forward or backwards by `n` colors |
|
||||
| `palette_size` | int | 3 | read-only | Number of colors in the palette (automatically updated when palette changes) |
|
||||
| *(inherits brightness from ColorProvider)* | | | | |
|
||||
|
||||
**Note**: The `get_color_for_value()` method accepts values in the 0-255 range for value-based color mapping.
|
||||
|
||||
**Modes**: Auto-cycle (`cycle_period > 0`) or Manual-only (`cycle_period = 0`)
|
||||
**Modes**: Auto-cycle (`period > 0`) or Manual-only (`period = 0`)
|
||||
|
||||
#### Usage Examples
|
||||
|
||||
```berry
|
||||
# RGB cycle with brutal switching
|
||||
color rgb_cycle = color_cycle(
|
||||
palette=bytes("FF0000FF" "FF00FF00" "FFFF0000"),
|
||||
cycle_period=4s
|
||||
colors=bytes("FF0000FF" "FF00FF00" "FFFF0000"),
|
||||
period=4s
|
||||
)
|
||||
|
||||
# Custom warm colors
|
||||
color warm_cycle = color_cycle(
|
||||
palette=bytes("FF4500FF" "FF8C00FF" "FFFF00"),
|
||||
cycle_period=3s
|
||||
colors=bytes("FF4500FF" "FF8C00FF" "FFFF00"),
|
||||
period=3s
|
||||
)
|
||||
|
||||
# Mixed colors in AARRGGBB format
|
||||
color mixed_cycle = color_cycle(
|
||||
palette=bytes("FFFF0000" "FF00FF00" "FF0000FF"),
|
||||
cycle_period=2s
|
||||
colors=bytes("FFFF0000" "FF00FF00" "FF0000FF"),
|
||||
period=2s
|
||||
)
|
||||
```
|
||||
|
||||
@ -424,8 +424,8 @@ Generates colors from predefined palettes with smooth transitions and profession
|
||||
|
||||
| Parameter | Type | Default | Constraints | Description |
|
||||
|-----------|------|---------|-------------|-------------|
|
||||
| `palette` | bytes | rainbow palette | - | Palette bytes or predefined palette constant |
|
||||
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
|
||||
| `colors` | bytes | rainbow palette | - | Palette bytes or predefined palette constant |
|
||||
| `period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
|
||||
| `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out |
|
||||
| *(inherits brightness from ColorProvider)* | | | | |
|
||||
|
||||
@ -442,16 +442,16 @@ Generates colors from predefined palettes with smooth transitions and profession
|
||||
```berry
|
||||
# Rainbow palette with smooth ease-in/ease-out transitions
|
||||
color rainbow_colors = rich_palette(
|
||||
palette=PALETTE_RAINBOW,
|
||||
cycle_period=5s,
|
||||
colors=PALETTE_RAINBOW,
|
||||
period=5s,
|
||||
transition_type=SINE,
|
||||
brightness=255
|
||||
)
|
||||
|
||||
# Fire effect with linear (constant speed) transitions
|
||||
color fire_colors = rich_palette(
|
||||
palette=PALETTE_FIRE,
|
||||
cycle_period=3s,
|
||||
colors=PALETTE_FIRE,
|
||||
period=3s,
|
||||
transition_type=LINEAR,
|
||||
brightness=200
|
||||
)
|
||||
@ -509,7 +509,7 @@ color deep_breath = breathe_color(
|
||||
)
|
||||
|
||||
# Using dynamic base color
|
||||
color rainbow_cycle = color_cycle(palette=bytes("FF0000FF" "FF00FF00" "FFFF0000"), cycle_period=5s)
|
||||
color rainbow_cycle = color_cycle(colors=bytes("FF0000FF" "FF00FF00" "FFFF0000"), period=5s)
|
||||
color breathing_rainbow = breathe_color(
|
||||
base_color=rainbow_cycle,
|
||||
min_brightness=30,
|
||||
@ -634,7 +634,7 @@ meter.color_source = rainbow
|
||||
meter.level = 128
|
||||
|
||||
# Meter with peak hold (1 second)
|
||||
color fire_colors = rich_palette(palette=PALETTE_FIRE)
|
||||
color fire_colors = rich_palette(colors=PALETTE_FIRE)
|
||||
animation vu_meter = gradient_meter_animation(peak_hold=1000)
|
||||
vu_meter.color_source = fire_colors
|
||||
|
||||
@ -962,14 +962,14 @@ Creates smooth color transitions using rich palette data with direct parameter a
|
||||
|
||||
| Parameter | Type | Default | Constraints | Description |
|
||||
|-----------|------|---------|-------------|-------------|
|
||||
| `palette` | bytes | rainbow palette | - | Palette bytes or predefined palette |
|
||||
| `cycle_period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
|
||||
| `colors` | bytes | rainbow palette | - | Palette bytes or predefined palette |
|
||||
| `period` | int | 5000 | min: 0 | Cycle time in ms (0 = value-based only) |
|
||||
| `transition_type` | int | animation.LINEAR | enum: [animation.LINEAR, animation.SINE] | LINEAR=constant speed, SINE=smooth ease-in/ease-out |
|
||||
| `brightness` | int | 255 | 0-255 | Overall brightness scaling |
|
||||
| *(inherits all Animation parameters)* | | | | |
|
||||
|
||||
**Special Features**:
|
||||
- Direct parameter access (set `anim.palette` instead of `anim.color.palette`)
|
||||
- Direct parameter access (set `anim.colors` instead of `anim.color.colors`)
|
||||
- Parameters are automatically forwarded to internal `RichPaletteColorProvider`
|
||||
- Access to specialized methods via `anim.color_provider.method_name()`
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ class MyColorProvider : animation.color_provider
|
||||
# Mark LUT as dirty when parameters change
|
||||
def on_param_changed(name, value)
|
||||
super(self).on_param_changed(name, value)
|
||||
if name == "palette" || name == "transition_type"
|
||||
if name == "colors" || name == "transition_type"
|
||||
self._lut_dirty = true # Inherited from ColorProvider
|
||||
end
|
||||
end
|
||||
|
||||
@ -373,8 +373,8 @@ color my_white = white # Reference to predefined color
|
||||
|
||||
# Color providers for dynamic colors
|
||||
color rainbow_cycle = color_cycle(
|
||||
palette=bytes("FFFF0000" "FF00FF00" "FF0000FF")
|
||||
cycle_period=5s
|
||||
colors=bytes("FFFF0000" "FF00FF00" "FF0000FF")
|
||||
period=5s
|
||||
)
|
||||
color breathing_red = breathe_color(
|
||||
base_color=red
|
||||
@ -485,8 +485,8 @@ animation.register_user_function("custom_palette", create_custom_palette)
|
||||
```berry
|
||||
# Use in DSL
|
||||
animation dynamic_anim = rich_palette(
|
||||
palette=custom_palette(0xFF0000, 200)
|
||||
cycle_period=3s
|
||||
colors=custom_palette(0xFF0000, 200)
|
||||
period=3s
|
||||
)
|
||||
```
|
||||
|
||||
@ -783,7 +783,7 @@ sequence cylon_eye repeat forever {
|
||||
# Option 3: Parametric repeat count
|
||||
sequence rainbow_cycle repeat palette.size times {
|
||||
play animation for 1s
|
||||
palette.next = 1
|
||||
colors.next = 1
|
||||
}
|
||||
```
|
||||
|
||||
@ -1064,7 +1064,7 @@ template animation shutter_effect {
|
||||
set strip_len = strip_length()
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = duration)
|
||||
|
||||
color col = color_cycle(palette=colors, cycle_period=0)
|
||||
color col = color_cycle(colors=colors, period=0)
|
||||
|
||||
animation shutter = beacon_animation(
|
||||
color = col
|
||||
@ -1136,7 +1136,7 @@ template animation fade_effect {
|
||||
# 'duration' is an implicit parameter - no need to declare it
|
||||
set oscillator = sawtooth(min_value=0, max_value=255, duration=duration)
|
||||
|
||||
color col = color_cycle(palette=colors, cycle_period=0)
|
||||
color col = color_cycle(colors=colors, period=0)
|
||||
animation test = solid(color=col)
|
||||
|
||||
# 'opacity' is also implicit
|
||||
|
||||
@ -321,7 +321,7 @@ template animation shutter_effect {
|
||||
param duration type time min 0 max 3600 default 5 nillable false
|
||||
|
||||
set strip_len = strip_length()
|
||||
color col = color_cycle(palette=colors, cycle_period=0)
|
||||
color col = color_cycle(colors=colors, period=0)
|
||||
|
||||
animation shutter = beacon_animation(
|
||||
color = col
|
||||
@ -351,8 +351,8 @@ class shutter_effect_animation : animation.engine_proxy
|
||||
|
||||
var strip_len_ = animation.strip_length(engine)
|
||||
var col_ = animation.color_cycle(engine)
|
||||
col_.palette = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col_.cycle_period = 0
|
||||
col_.colors = animation.create_closure_value(engine, def (engine) return self.colors end)
|
||||
col_.period = 0
|
||||
|
||||
var shutter_ = animation.beacon_animation(engine)
|
||||
shutter_.color = col_
|
||||
|
||||
@ -54,7 +54,7 @@ palette fire_colors = [
|
||||
(255, 0xFFFF00) # Yellow
|
||||
]
|
||||
|
||||
animation fire_effect = palette_animation(palette=fire_colors, period=2s, intensity=255)
|
||||
animation fire_effect = palette_animation(colors=fire_colors, period=2s, intensity=255)
|
||||
run fire_effect
|
||||
```
|
||||
|
||||
@ -131,7 +131,7 @@ set cosine_val = cosine_osc(min_value=0, max_value=27, duration=5s)
|
||||
|
||||
# Create color 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, period=0)
|
||||
|
||||
# Create beacon animation
|
||||
animation red_eye = beacon_animation(
|
||||
@ -290,7 +290,7 @@ run nested_pattern
|
||||
set triangle_pos = triangle(min_value=0, max_value=29, period=3s)
|
||||
set cosine_pos = cosine_osc(min_value=0, max_value=29, period=3s)
|
||||
|
||||
color eye_color = color_cycle(palette=[red, yellow, green, blue], cycle_period=0)
|
||||
color eye_color = color_cycle(colors=[red, yellow, green, blue], period=0)
|
||||
animation moving_eye = beacon_animation(
|
||||
color=eye_color
|
||||
pos=triangle_pos
|
||||
@ -445,15 +445,15 @@ template breathing_rainbow {
|
||||
param base_brightness
|
||||
|
||||
# Create rainbow palette
|
||||
palette rainbow = [
|
||||
colors rainbow = [
|
||||
(0, red), (42, orange), (85, yellow)
|
||||
(128, green), (170, blue), (213, purple), (255, red)
|
||||
]
|
||||
|
||||
# Create cycling rainbow color
|
||||
color rainbow_cycle = color_cycle(
|
||||
palette=rainbow
|
||||
cycle_period=cycle_time
|
||||
colors=rainbow
|
||||
period=cycle_time
|
||||
)
|
||||
|
||||
# Create breathing animation with rainbow colors
|
||||
|
||||
@ -29,8 +29,8 @@ Create smooth color transitions:
|
||||
```berry
|
||||
# Use predefined rainbow palette
|
||||
animation rainbow_cycle = rich_palette(
|
||||
palette=PALETTE_RAINBOW
|
||||
cycle_period=5s
|
||||
colors=PALETTE_RAINBOW
|
||||
period=5s
|
||||
transition_type=1
|
||||
)
|
||||
|
||||
@ -53,8 +53,8 @@ palette sunset = [
|
||||
|
||||
# Create palette animation
|
||||
animation sunset_glow = rich_palette(
|
||||
palette=sunset
|
||||
cycle_period=8s
|
||||
colors=sunset
|
||||
period=8s
|
||||
transition_type=1
|
||||
)
|
||||
|
||||
@ -138,8 +138,8 @@ run breathing
|
||||
### Fire Effect
|
||||
```berry
|
||||
animation fire = rich_palette(
|
||||
palette=PALETTE_FIRE
|
||||
cycle_period=2s
|
||||
colors=PALETTE_FIRE
|
||||
period=2s
|
||||
transition_type=1
|
||||
)
|
||||
|
||||
@ -170,7 +170,7 @@ template animation shutter_effect {
|
||||
param duration type time min 0 max 3600 default 5 nillable false
|
||||
|
||||
set strip_len = strip_length()
|
||||
color col = color_cycle(palette=colors, cycle_period=0)
|
||||
color col = color_cycle(colors=colors, period=0)
|
||||
|
||||
animation shutter = beacon_animation(
|
||||
color = col
|
||||
|
||||
@ -346,7 +346,7 @@ _detect_and_cache_symbol(name)
|
||||
|
||||
**Palette Detection:**
|
||||
```berry
|
||||
# DSL: animation rainbow = rich_palette_animation(palette=PALETTE_RAINBOW)
|
||||
# DSL: animation rainbow = rich_palette_animation(colors=PALETTE_RAINBOW)
|
||||
# Detection: PALETTE_RAINBOW exists in animation module, isinstance(obj, bytes)
|
||||
# Result: SymbolEntry("PALETTE_RAINBOW", "palette", bytes_instance, true)
|
||||
# Reference: "animation.PALETTE_RAINBOW"
|
||||
|
||||
@ -164,8 +164,8 @@ dim_blue.opacity = bright(30)
|
||||
```berry
|
||||
def custom_fire(engine, intensity, speed)
|
||||
var color_provider = animation.rich_palette(engine)
|
||||
color_provider.palette = animation.PALETTE_FIRE
|
||||
color_provider.cycle_period = speed
|
||||
color_provider.colors = animation.PALETTE_FIRE
|
||||
color_provider.period = speed
|
||||
|
||||
var fire_anim = animation.filled(engine)
|
||||
fire_anim.color_provider = color_provider
|
||||
@ -237,8 +237,8 @@ right_pulse.position = pulse_at(25, 3, 2000)
|
||||
def rainbow_twinkle(engine, base_speed, twinkle_density)
|
||||
# Create base rainbow animation
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.palette = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = base_speed
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.period = base_speed
|
||||
|
||||
var base_anim = animation.filled(engine)
|
||||
base_anim.color_provider = rainbow_provider
|
||||
@ -289,10 +289,10 @@ animation.register_user_function("custom_palette", create_custom_palette)
|
||||
```
|
||||
|
||||
```berry
|
||||
# Use dynamic palette in DSL
|
||||
# Use dynamic colors in DSL
|
||||
animation gradient_effect = rich_palette(
|
||||
palette=custom_palette(0xFF6B35, 5, 255)
|
||||
cycle_period=4s
|
||||
colors=custom_palette(0xFF6B35, 5, 255)
|
||||
period=4s
|
||||
)
|
||||
|
||||
run gradient_effect
|
||||
|
||||
@ -184,7 +184,7 @@ class FireAnimation : animation.animation
|
||||
# Create default fire palette on demand
|
||||
var fire_provider = animation.rich_palette(self.engine)
|
||||
fire_provider.colors = animation.PALETTE_FIRE
|
||||
fire_provider.cycle_period = 0 # Use value-based color mapping, not time-based
|
||||
fire_provider.period = 0 # Use value-based color mapping, not time-based
|
||||
fire_provider.transition_type = 1 # Use sine transition (smooth)
|
||||
fire_provider.brightness = 255
|
||||
resolved_color = fire_provider
|
||||
|
||||
@ -47,7 +47,7 @@ class NoiseAnimation : animation.animation
|
||||
if self.color == nil
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
self.color = rainbow_provider
|
||||
@ -100,7 +100,7 @@ class NoiseAnimation : animation.animation
|
||||
|
||||
var gradient_provider = animation.rich_palette(self.engine)
|
||||
gradient_provider.colors = palette
|
||||
gradient_provider.cycle_period = 5000
|
||||
gradient_provider.period = 5000
|
||||
gradient_provider.transition_type = 1
|
||||
gradient_provider.brightness = 255
|
||||
|
||||
@ -261,7 +261,7 @@ def noise_rainbow(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
anim.color = rainbow_provider
|
||||
@ -288,7 +288,7 @@ def noise_fractal(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
anim.color = rainbow_provider
|
||||
|
||||
@ -18,7 +18,7 @@ class RichPaletteAnimation : animation.animation
|
||||
static var PARAMS = animation.enc_params({
|
||||
# RichPaletteColorProvider parameters (forwarded to internal provider)
|
||||
"colors": {"type": "instance", "default": nil},
|
||||
"cycle_period": {"min": 0, "default": 5000},
|
||||
"period": {"min": 0, "default": 5000},
|
||||
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.SINE},
|
||||
"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 == "colors" || name == "cycle_period" || name == "transition_type" ||
|
||||
if name == "colors" || name == "period" || name == "transition_type" ||
|
||||
name == "brightness"
|
||||
# Set parameter on internal color provider
|
||||
self.color_provider.set_param(name, value)
|
||||
|
||||
@ -234,7 +234,7 @@ def wave_rainbow_sine(engine)
|
||||
# Set up rainbow color provider
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1 # sine transition
|
||||
rainbow_provider.brightness = 255
|
||||
anim.color = rainbow_provider
|
||||
|
||||
@ -71,7 +71,7 @@ class PlasmaAnimation : animation.animation
|
||||
if self.color == nil
|
||||
var rainbow_provider = animation.rich_palette(self.engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
self.color = rainbow_provider
|
||||
@ -90,7 +90,7 @@ class PlasmaAnimation : animation.animation
|
||||
# Reset to default rainbow palette when color is set to nil
|
||||
var rainbow_provider = animation.rich_palette(self.engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1
|
||||
rainbow_provider.brightness = 255
|
||||
# Set the parameter directly to avoid recursion
|
||||
|
||||
@ -238,7 +238,7 @@ end
|
||||
def sparkle_rainbow(engine)
|
||||
var rainbow_provider = animation.rich_palette(engine)
|
||||
rainbow_provider.colors = animation.PALETTE_RAINBOW
|
||||
rainbow_provider.cycle_period = 5000
|
||||
rainbow_provider.period = 5000
|
||||
rainbow_provider.transition_type = 1 # sine transition
|
||||
|
||||
var anim = animation.sparkle_animation(engine)
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
# No transitions or interpolation - just instant color changes.
|
||||
#
|
||||
# Modes:
|
||||
# - Auto-cycle: cycle_period > 0 - colors change automatically at regular intervals
|
||||
# - Manual-only: cycle_period = 0 - colors only change when 'next' parameter is set to 1
|
||||
# - Auto-cycle: period > 0 - colors change automatically at regular intervals
|
||||
# - Manual-only: period = 0 - colors only change when 'next' parameter is set to 1
|
||||
#
|
||||
# Follows the parameterized class specification:
|
||||
# - Constructor takes only 'engine' parameter
|
||||
@ -21,7 +21,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
# Parameter definitions
|
||||
static var PARAMS = animation.enc_params({
|
||||
"colors": {"type": "bytes", "default":nil},
|
||||
"cycle_period": {"min": 0, "default": 5000}, # 0 = manual only, >0 = auto cycle time in ms
|
||||
"period": {"min": 0, "default": 5000}, # 0 = manual only, >0 = auto cycle time in ms
|
||||
"next": {"default": 0}, # Write `<n>` to move to next <n> colors
|
||||
"palette_size": {"type": "int", "default": 3} # Read-only: number of colors in palette
|
||||
})
|
||||
@ -127,12 +127,12 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
# @return int - Color in ARGB format (0xAARRGGBB)
|
||||
def produce_value(name, time_ms)
|
||||
# Get parameter values using virtual member access
|
||||
var cycle_period = self.cycle_period
|
||||
var period = self.period
|
||||
|
||||
# Get the number of colors in the palette
|
||||
var palette_size = self._get_palette_size()
|
||||
|
||||
if (palette_size <= 1) || (cycle_period == 0) # no cycling stop here
|
||||
if (palette_size <= 1) || (period == 0) # no cycling stop here
|
||||
var idx = self.current_index
|
||||
if (idx >= palette_size) idx = palette_size - 1 end
|
||||
if (idx < 0) idx = 0 end
|
||||
@ -148,8 +148,8 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
end
|
||||
|
||||
# Auto-cycle mode: calculate which color to show based on time (brutal switching using integer math)
|
||||
var time_in_cycle = time_ms % cycle_period
|
||||
var color_index = tasmota.scale_uint(time_in_cycle, 0, cycle_period - 1, 0, palette_size - 1)
|
||||
var time_in_cycle = time_ms % period
|
||||
var color_index = tasmota.scale_uint(time_in_cycle, 0, period - 1, 0, palette_size - 1)
|
||||
|
||||
# Clamp to valid range (safety check)
|
||||
if color_index >= palette_size
|
||||
@ -217,7 +217,7 @@ class ColorCycleColorProvider : animation.color_provider
|
||||
|
||||
# String representation of the provider
|
||||
def tostring()
|
||||
return f"ColorCycleColorProvider(palette_size={self._get_palette_size()}, cycle_period={self.cycle_period}, mode={self.cycle_period ? 'manual' :: 'auto'}, current_index={self.current_index})"
|
||||
return f"ColorCycleColorProvider(palette_size={self._get_palette_size()}, period={self.period}, mode={self.period ? 'manual' :: 'auto'}, current_index={self.current_index})"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ import "./core/param_encoder" as encode_constraints
|
||||
#@ solidify:RichPaletteColorProvider,weak
|
||||
class RichPaletteColorProvider : animation.color_provider
|
||||
# Non-parameter instance variables only
|
||||
var _slots_arr # Constructed array of timestamp slots, based on cycle_period
|
||||
var _slots_arr # Constructed array of timestamp slots, based on period
|
||||
var _value_arr # Constructed array of value slots (always 0-255 range)
|
||||
var _slots # Number of slots in the palette
|
||||
var _current_color # Current interpolated color (calculated during update)
|
||||
@ -43,7 +43,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
# Parameter definitions
|
||||
static var PARAMS = animation.enc_params({
|
||||
"colors": {"type": "bytes", "default": nil}, # Palette bytes or predefined palette constant
|
||||
"cycle_period": {"min": 0, "default": 5000}, # 5 seconds default, 0 = value-based only
|
||||
"period": {"min": 0, "default": 5000}, # 5 seconds default, 0 = value-based only
|
||||
"transition_type": {"enum": [animation.LINEAR, animation.SINE], "default": animation.LINEAR}
|
||||
# brightness parameter inherited from ColorProvider base class
|
||||
})
|
||||
@ -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 == "colors"
|
||||
if name == "period" || name == "colors"
|
||||
if (self._slots_arr != nil) || (self._value_arr != nil)
|
||||
# only if they were already computed
|
||||
self._recompute_palette()
|
||||
@ -120,14 +120,14 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
|
||||
# Recompute palette slots and metadata
|
||||
def _recompute_palette()
|
||||
# Compute slots_arr based on 'cycle_period'
|
||||
var cycle_period = self.cycle_period
|
||||
# Compute slots_arr based on 'period'
|
||||
var period = self.period
|
||||
var palette_bytes = self._get_palette_bytes()
|
||||
self._slots = size(palette_bytes) / 4
|
||||
|
||||
# Recompute palette with new cycle period (only if > 0 for time-based cycling)
|
||||
if cycle_period > 0 && palette_bytes != nil
|
||||
self._slots_arr = self._parse_palette(0, cycle_period - 1)
|
||||
if period > 0 && palette_bytes != nil
|
||||
self._slots_arr = self._parse_palette(0, period - 1)
|
||||
else
|
||||
self._slots_arr = nil
|
||||
end
|
||||
@ -271,11 +271,11 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
end
|
||||
|
||||
# Get parameter values using virtual member access
|
||||
var cycle_period = self.cycle_period
|
||||
var period = self.period
|
||||
var brightness = self.brightness
|
||||
|
||||
# If cycle_period is 0, return static color (first color in palette)
|
||||
if cycle_period == 0
|
||||
# If period is 0, return static color (first color in palette)
|
||||
if period == 0
|
||||
var bgrt0 = palette_bytes.get(0, 4)
|
||||
var r = (bgrt0 >> 8) & 0xFF
|
||||
var g = (bgrt0 >> 16) & 0xFF
|
||||
@ -295,7 +295,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
|
||||
# Calculate position in cycle using start_time
|
||||
var elapsed = time_ms - self.start_time
|
||||
var past = elapsed % cycle_period
|
||||
var past = elapsed % period
|
||||
|
||||
# Find slot (exact algorithm from Animate_palette)
|
||||
var slots = self._slots
|
||||
@ -520,7 +520,7 @@ class RichPaletteColorProvider : animation.color_provider
|
||||
# String representation
|
||||
def tostring()
|
||||
try
|
||||
return f"RichPaletteColorProvider(slots={self._slots}, cycle_period={self.cycle_period})"
|
||||
return f"RichPaletteColorProvider(slots={self._slots}, period={self.period})"
|
||||
except ..
|
||||
return "RichPaletteColorProvider(uninitialized)"
|
||||
end
|
||||
|
||||
@ -315,7 +315,7 @@ static const bvalue be_ktab_class_RichPaletteAnimation[13] = {
|
||||
/* K6 */ be_nested_str_weak(start),
|
||||
/* K7 */ be_nested_str_weak(on_param_changed),
|
||||
/* K8 */ be_nested_str_weak(colors),
|
||||
/* K9 */ be_nested_str_weak(cycle_period),
|
||||
/* K9 */ be_nested_str_weak(period),
|
||||
/* K10 */ be_nested_str_weak(transition_type),
|
||||
/* K11 */ be_nested_str_weak(brightness),
|
||||
/* K12 */ be_nested_str_weak(set_param),
|
||||
@ -463,10 +463,10 @@ be_local_class(RichPaletteAnimation,
|
||||
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
|
||||
be_const_map( * be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400050200010005) },
|
||||
{ be_const_key_weak(period, -1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0605) },
|
||||
{ be_const_key_weak(brightness, -1), be_const_bytes_instance(07000001FF0001FF00) },
|
||||
{ be_const_key_weak(cycle_period, 0), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400050200010005) },
|
||||
})) ) } )) },
|
||||
{ be_const_key_weak(color_provider, -1), be_const_var(0) },
|
||||
})),
|
||||
@ -526,7 +526,7 @@ be_local_closure(noise_rainbow, /* name */
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K5 */ be_nested_str_weak(period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
/* K7 */ be_const_int(1),
|
||||
/* K8 */ be_nested_str_weak(brightness),
|
||||
@ -1768,7 +1768,7 @@ static const bvalue be_ktab_class_FireAnimation[47] = {
|
||||
/* K38 */ be_nested_str_weak(rich_palette),
|
||||
/* K39 */ be_nested_str_weak(colors),
|
||||
/* K40 */ be_nested_str_weak(PALETTE_FIRE),
|
||||
/* K41 */ be_nested_str_weak(cycle_period),
|
||||
/* K41 */ be_nested_str_weak(period),
|
||||
/* K42 */ be_nested_str_weak(transition_type),
|
||||
/* K43 */ be_nested_str_weak(brightness),
|
||||
/* K44 */ be_nested_str_weak(is_color_provider),
|
||||
@ -2401,8 +2401,8 @@ static const bvalue be_ktab_class_RichPaletteColorProvider[58] = {
|
||||
/* K26 */ be_nested_str_weak(_X2C_X23_X2502X_X2502X_X2502X_X20_X25_X2E1f_X25_X25),
|
||||
/* K27 */ be_const_real_hex(0x41200000),
|
||||
/* K28 */ be_nested_str_weak(_X29_X3B),
|
||||
/* K29 */ be_nested_str_weak(RichPaletteColorProvider_X28slots_X3D_X25s_X2C_X20cycle_period_X3D_X25s_X29),
|
||||
/* K30 */ be_nested_str_weak(cycle_period),
|
||||
/* K29 */ be_nested_str_weak(RichPaletteColorProvider_X28slots_X3D_X25s_X2C_X20period_X3D_X25s_X29),
|
||||
/* K30 */ be_nested_str_weak(period),
|
||||
/* K31 */ be_nested_str_weak(RichPaletteColorProvider_X28uninitialized_X29),
|
||||
/* K32 */ be_nested_str_weak(_current_color),
|
||||
/* K33 */ be_nested_str_weak(_get_color_at_index),
|
||||
@ -3596,7 +3596,7 @@ be_local_class(RichPaletteColorProvider,
|
||||
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
|
||||
be_const_map( * be_nested_map(3,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(cycle_period, 1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(period, 1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(transition_type, -1), be_const_bytes_instance(1400010200010005) },
|
||||
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) },
|
||||
})) ) } )) },
|
||||
@ -3722,7 +3722,7 @@ be_local_closure(unregister_event_handler, /* name */
|
||||
|
||||
// compact class 'ColorCycleColorProvider' ktab size: 27, total: 54 (saved 216 bytes)
|
||||
static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
|
||||
/* K0 */ be_nested_str_weak(cycle_period),
|
||||
/* K0 */ be_nested_str_weak(period),
|
||||
/* K1 */ be_nested_str_weak(_get_palette_size),
|
||||
/* K2 */ be_const_int(1),
|
||||
/* K3 */ be_const_int(0),
|
||||
@ -3732,7 +3732,7 @@ static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
|
||||
/* K7 */ be_nested_str_weak(apply_brightness),
|
||||
/* K8 */ be_nested_str_weak(tasmota),
|
||||
/* K9 */ be_nested_str_weak(scale_uint),
|
||||
/* K10 */ be_nested_str_weak(ColorCycleColorProvider_X28palette_size_X3D_X25s_X2C_X20cycle_period_X3D_X25s_X2C_X20mode_X3D_X25s_X2C_X20current_index_X3D_X25s_X29),
|
||||
/* K10 */ be_nested_str_weak(ColorCycleColorProvider_X28palette_size_X3D_X25s_X2C_X20period_X3D_X25s_X2C_X20mode_X3D_X25s_X2C_X20current_index_X3D_X25s_X29),
|
||||
/* K11 */ be_nested_str_weak(manual),
|
||||
/* K12 */ be_nested_str_weak(auto),
|
||||
/* K13 */ be_nested_str_weak(colors),
|
||||
@ -4205,10 +4205,10 @@ be_local_class(ColorCycleColorProvider,
|
||||
{ be_const_key_weak(PARAMS, -1), be_const_simple_instance(be_nested_simple_instance(&be_class_map, {
|
||||
be_const_map( * be_nested_map(4,
|
||||
( (struct bmapnode*) &(const bmapnode[]) {
|
||||
{ be_const_key_weak(next, 2), be_const_bytes_instance(040000) },
|
||||
{ be_const_key_weak(period, 2), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(colors, -1), be_const_bytes_instance(0C0602) },
|
||||
{ be_const_key_weak(palette_size, -1), be_const_bytes_instance(0C000300) },
|
||||
{ be_const_key_weak(cycle_period, -1), be_const_bytes_instance(050000018813) },
|
||||
{ be_const_key_weak(palette_size, 3), be_const_bytes_instance(0C000300) },
|
||||
{ be_const_key_weak(next, -1), be_const_bytes_instance(040000) },
|
||||
})) ) } )) },
|
||||
{ be_const_key_weak(init, -1), be_const_closure(class_ColorCycleColorProvider_init_closure) },
|
||||
{ be_const_key_weak(produce_value, 0), be_const_closure(class_ColorCycleColorProvider_produce_value_closure) },
|
||||
@ -7843,7 +7843,7 @@ static const bvalue be_ktab_class_NoiseAnimation[49] = {
|
||||
/* K12 */ be_nested_str_weak(rich_palette),
|
||||
/* K13 */ be_nested_str_weak(colors),
|
||||
/* K14 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K15 */ be_nested_str_weak(cycle_period),
|
||||
/* K15 */ be_nested_str_weak(period),
|
||||
/* K16 */ be_nested_str_weak(transition_type),
|
||||
/* K17 */ be_nested_str_weak(brightness),
|
||||
/* K18 */ be_nested_str_weak(int),
|
||||
@ -10610,7 +10610,7 @@ be_local_closure(wave_rainbow_sine, /* name */
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K5 */ be_nested_str_weak(period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
/* K7 */ be_const_int(1),
|
||||
/* K8 */ be_nested_str_weak(brightness),
|
||||
@ -17956,7 +17956,7 @@ be_local_closure(noise_fractal, /* name */
|
||||
/* K2 */ be_nested_str_weak(rich_palette),
|
||||
/* K3 */ be_nested_str_weak(colors),
|
||||
/* K4 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||
/* K5 */ be_nested_str_weak(cycle_period),
|
||||
/* K5 */ be_nested_str_weak(period),
|
||||
/* K6 */ be_nested_str_weak(transition_type),
|
||||
/* K7 */ be_const_int(1),
|
||||
/* K8 */ be_nested_str_weak(brightness),
|
||||
|
||||
@ -71,7 +71,7 @@ class ColorCycleAnimationTest
|
||||
var custom_palette = bytes("FFFF0000FF00FF00") # Red and Green in AARRGGBB format
|
||||
var custom_provider = animation.color_cycle(engine)
|
||||
custom_provider.colors = custom_palette
|
||||
custom_provider.cycle_period = 2000
|
||||
custom_provider.period = 2000
|
||||
|
||||
var anim2 = animation.solid(engine)
|
||||
anim2.color = custom_provider
|
||||
@ -87,7 +87,7 @@ class ColorCycleAnimationTest
|
||||
|
||||
# Check provider properties
|
||||
self.assert_equal(color_provider2._get_palette_size(), 2, "Custom colors has 2 colors")
|
||||
self.assert_equal(color_provider2.cycle_period, 2000, "Custom cycle period is 2000ms")
|
||||
self.assert_equal(color_provider2.period, 2000, "Custom cycle period is 2000ms")
|
||||
end
|
||||
|
||||
def test_update_and_render()
|
||||
@ -95,7 +95,7 @@ class ColorCycleAnimationTest
|
||||
var colors = bytes("FFFF0000FF0000FF") # Red and Blue in AARRGGBB format
|
||||
var provider = animation.color_cycle(engine)
|
||||
provider.colors = colors
|
||||
provider.cycle_period = 1000 # 1 second cycle
|
||||
provider.period = 1000 # 1 second cycle
|
||||
|
||||
var anim = animation.solid(engine)
|
||||
anim.color = provider
|
||||
@ -138,12 +138,12 @@ class ColorCycleAnimationTest
|
||||
end
|
||||
|
||||
def test_manual_only_mode()
|
||||
print("Testing manual-only mode (cycle_period = 0)...")
|
||||
print("Testing manual-only mode (period = 0)...")
|
||||
|
||||
# Create animation with manual-only color provider
|
||||
var manual_provider = animation.color_cycle(engine)
|
||||
manual_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format
|
||||
manual_provider.cycle_period = 0 # Manual-only mode
|
||||
manual_provider.period = 0 # Manual-only mode
|
||||
|
||||
var manual_anim = animation.solid(engine)
|
||||
manual_anim.color = manual_provider
|
||||
@ -192,7 +192,7 @@ class ColorCycleAnimationTest
|
||||
# Test direct creation without factory method (following new parameterized pattern)
|
||||
var provider = animation.color_cycle(engine)
|
||||
provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # Blue, Green, Red in AARRGGBB format
|
||||
provider.cycle_period = 3000 # 3 second cycle period
|
||||
provider.period = 3000 # 3 second cycle period
|
||||
|
||||
var anim = animation.solid(engine)
|
||||
anim.color = provider
|
||||
@ -209,7 +209,7 @@ class ColorCycleAnimationTest
|
||||
|
||||
# Check provider properties
|
||||
self.assert_equal(color_provider3._get_palette_size(), 3, "Palette has 3 colors")
|
||||
self.assert_equal(color_provider3.cycle_period, 3000, "Cycle period is 3000ms")
|
||||
self.assert_equal(color_provider3.period, 3000, "Cycle period is 3000ms")
|
||||
|
||||
# Check animation properties
|
||||
self.assert_equal(anim.priority, 10, "Priority is 10")
|
||||
|
||||
@ -54,7 +54,7 @@ def test_color_cycle_bytes_format()
|
||||
assert(custom_color3 == 0xFFFFFF00, f"Custom color 3 should be 0xFFFFFF00 (alpha forced), got 0x{custom_color3:08X}")
|
||||
|
||||
# Test 6: Test auto-cycle mode
|
||||
provider.cycle_period = 4000 # 4 seconds for 4 colors = 1 second per color
|
||||
provider.period = 4000 # 4 seconds for 4 colors = 1 second per color
|
||||
|
||||
# At time 0, should be first color
|
||||
engine.time_ms = 0
|
||||
@ -74,7 +74,7 @@ def test_color_cycle_bytes_format()
|
||||
assert(cycle_color3 == custom_color3, f"Cycle color at t=3000 should match fourth color")
|
||||
|
||||
# Test 7: Test manual mode
|
||||
provider.cycle_period = 0 # Manual mode
|
||||
provider.period = 0 # Manual mode
|
||||
provider.current_index = 1
|
||||
|
||||
var manual_color = provider.produce_value("color", 5000)
|
||||
|
||||
@ -99,7 +99,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.colors = bytes("FF0000FFFF00FF00FFFF0000FFFFFF00") # BGRY palette in AARRGGBB format
|
||||
palette_provider.cycle_period = 2000 # 2 second cycle
|
||||
palette_provider.period = 2000 # 2 second cycle
|
||||
|
||||
# Create animation with new parameterized pattern
|
||||
var crenel = animation.crenel_animation(engine)
|
||||
|
||||
@ -17,7 +17,7 @@ def test_demo_shutter_patterns()
|
||||
" param colors type palette\n" +
|
||||
" param duration\n" +
|
||||
" \n" +
|
||||
" color col1 = color_cycle(palette=colors, cycle_period=0)\n" +
|
||||
" color col1 = color_cycle(palette=colors, period=0)\n" +
|
||||
" animation test_anim = solid(color=col1)\n" +
|
||||
" \n" +
|
||||
" sequence shutter_seq repeat forever {\n" +
|
||||
@ -44,7 +44,7 @@ def test_demo_shutter_patterns()
|
||||
|
||||
# Test 2: The col1.next = 1 pattern
|
||||
print(" Testing color.next assignment...")
|
||||
var color_next = "color col1 = color_cycle(palette=[red, green], cycle_period=0)\n" +
|
||||
var color_next = "color col1 = color_cycle(palette=[red, green], period=0)\n" +
|
||||
"col1.next = 1\n" +
|
||||
"animation test_anim = solid(color=col1)\n" +
|
||||
"run test_anim"
|
||||
@ -87,7 +87,7 @@ def test_demo_shutter_patterns()
|
||||
" 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 col1 = color_cycle(palette=colors, period=0)\n" +
|
||||
" \n" +
|
||||
" animation shutter_anim = beacon_animation(\n" +
|
||||
" color = col1\n" +
|
||||
@ -123,8 +123,8 @@ def test_demo_shutter_patterns()
|
||||
" 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(palette=colors, period=0)\n" +
|
||||
" color col2 = color_cycle(palette=colors, period=0)\n" +
|
||||
" col2.next = 1\n" +
|
||||
" \n" +
|
||||
" animation shutter_inout = beacon_animation(\n" +
|
||||
|
||||
@ -47,7 +47,7 @@ def test_palette_newline_entries()
|
||||
" (192, 0x00AA00)\n" +
|
||||
" (255, 0x00FF00)\n" +
|
||||
"]\n" +
|
||||
"color stream_color = rich_palette(colors=matrix_greens, cycle_period=2s)\n" +
|
||||
"color stream_color = rich_palette(colors=matrix_greens, period=2s)\n" +
|
||||
"animation stream = solid(color=stream_color)\n" +
|
||||
"run stream"
|
||||
|
||||
@ -113,7 +113,7 @@ def test_color_provider_newline_syntax()
|
||||
"palette test_palette = [(0, 0x000000), (255, 0xFFFFFF)]\n" +
|
||||
"color dynamic_color = rich_palette(\n" +
|
||||
" colors=test_palette\n" +
|
||||
" cycle_period=2s\n" +
|
||||
" period=2s\n" +
|
||||
" transition_type=LINEAR\n" +
|
||||
" brightness=255\n" +
|
||||
")\n" +
|
||||
@ -125,7 +125,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_.colors = test_palette_") >= 0, "Should generate palette assignment")
|
||||
assert(string.find(berry_code, "dynamic_color_.cycle_period = 2000") >= 0, "Should generate cycle_period assignment")
|
||||
assert(string.find(berry_code, "dynamic_color_.period = 2000") >= 0, "Should generate period assignment")
|
||||
|
||||
print("✓ Color provider newline syntax test passed")
|
||||
return true
|
||||
@ -174,7 +174,7 @@ def test_complex_example()
|
||||
"\n" +
|
||||
"color stream_pattern = rich_palette(\n" +
|
||||
" colors=matrix_greens\n" +
|
||||
" cycle_period=2s\n" +
|
||||
" period=2s\n" +
|
||||
" transition_type=LINEAR\n" +
|
||||
" brightness=255\n" +
|
||||
")\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(colors=eye_palette, cycle_period=0)\n" +
|
||||
"color eye_color = color_cycle(colors=eye_palette, period=0)\n" +
|
||||
"set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
|
||||
"set 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(colors=my_color, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=my_color, period=0)\n" +
|
||||
" animation test = pulsating_animation(color=col, period=my_duration)\n" +
|
||||
" 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(colors=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, 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(colors=colors, cycle_period=0)\n" +
|
||||
" color col = color_cycle(colors=colors, period=0)\n" +
|
||||
" animation test = beacon_animation(color=col, beacon_size=shutter_size)\n" +
|
||||
" \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(colors=colors, cycle_period=0)\n" +
|
||||
" color col2 = color_cycle(colors=colors, cycle_period=0)\n" +
|
||||
" color col1 = color_cycle(colors=colors, period=0)\n" +
|
||||
" color col2 = color_cycle(colors=colors, 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(colors=eye_palette, cycle_period=0)\n" +
|
||||
"color eye_color = color_cycle(colors=eye_palette, period=0)\n" +
|
||||
"set cosine_val = cosine_osc(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
|
||||
"set triangle_val = triangle(min_value = 0, max_value = strip_len - 2, duration = 5s)\n" +
|
||||
"\n" +
|
||||
|
||||
@ -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(colors=[0xFF0000FF, 0xFF00FF00], cycle_period=oscillator_value(min_value=1000, bad_param=456)))\n"
|
||||
"animation test = pulsating_animation(color=color_cycle(colors=[0xFF0000FF, 0xFF00FF00], period=oscillator_value(min_value=1000, bad_param=456)))\n"
|
||||
"run test"
|
||||
|
||||
var compilation_failed = false
|
||||
|
||||
@ -58,7 +58,7 @@ assert(pixel_color == 0xFF0000FF, f"Expected 0xFF0000FF, got {pixel_color:08X}")
|
||||
print("Test 2: animation.solid with a color cycle provider")
|
||||
var cycle_provider = animation.color_cycle(mock_engine)
|
||||
cycle_provider.colors = bytes("FF0000FFFF00FF00FFFF0000") # BGR colors in AARRGGBB format
|
||||
cycle_provider.cycle_period = 1000 # 1 second cycle period
|
||||
cycle_provider.period = 1000 # 1 second cycle period
|
||||
# Note: transition_type removed - now uses "brutal" color switching
|
||||
|
||||
var cycle_anim = animation.solid(mock_engine)
|
||||
@ -83,7 +83,7 @@ assert(result, "Render should return true")
|
||||
print("Test 3: animation.solid with a rich palette provider")
|
||||
var rich_provider = animation.rich_palette(mock_engine)
|
||||
rich_provider.colors = animation.PALETTE_RAINBOW # Use the rainbow palette
|
||||
rich_provider.cycle_period = 1000 # 1 second cycle period
|
||||
rich_provider.period = 1000 # 1 second cycle period
|
||||
# Note: transition_type removed - rich palette uses smooth transitions
|
||||
rich_provider.brightness = 255 # Full brightness
|
||||
|
||||
@ -109,7 +109,7 @@ assert(result, "Render should return true")
|
||||
print("Test 4: animation.solid with a composite provider")
|
||||
var rich_provider2 = animation.rich_palette(mock_engine)
|
||||
rich_provider2.colors = animation.PALETTE_RAINBOW
|
||||
rich_provider2.cycle_period = 1000
|
||||
rich_provider2.period = 1000
|
||||
# Note: transition_type removed
|
||||
rich_provider2.brightness = 255
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ print("Set to solid red color")
|
||||
# Set back to fire palette
|
||||
var fire_palette = animation.rich_palette(engine)
|
||||
fire_palette.colors = animation.PALETTE_FIRE
|
||||
fire_palette.cycle_period = 5000
|
||||
fire_palette.period = 5000
|
||||
fire_palette.transition_type = 1 # Use sine transition (smooth)
|
||||
fire_palette.brightness = 255
|
||||
fire.color = fire_palette
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user