35 lines
852 B
Plaintext
35 lines
852 B
Plaintext
# Palette Demo - Shows how to use custom palettes in DSL
|
|
# This demonstrates the new palette syntax
|
|
|
|
#strip length 30
|
|
|
|
# Define a fire palette
|
|
palette fire_colors = [ (0, 0x000000), (64, 0x800000), (128, 0xFF0000), (192, 0xFF8000), (255, 0xFFFF00) ]
|
|
|
|
# Define an ocean palette
|
|
palette ocean_colors = [
|
|
(0, 0x000080) # Navy blue
|
|
(64, 0x0000FF), # Blue
|
|
(128, 0x00FFFF) # Cyan
|
|
(192, 0x00FF80), # Spring green
|
|
(255, 0x008000) # Green
|
|
]
|
|
|
|
# Create animations using the palettes
|
|
animation fire_anim = rich_palette(colors=fire_colors, period=5s)
|
|
|
|
animation ocean_anim = rich_palette(colors=ocean_colors, period=8s)
|
|
|
|
# Sequence to show both palettes
|
|
sequence palette_demo {
|
|
play fire_anim for 10s
|
|
wait 1s
|
|
play ocean_anim for 10s
|
|
wait 1s
|
|
repeat 2 times {
|
|
play fire_anim for 3s
|
|
play ocean_anim for 3s
|
|
}
|
|
}
|
|
|
|
run palette_demo |