Files
2025-09-08 23:30:57 +02:00

147 lines
4.7 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: disco_strobe.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
import animation
# Disco Strobe - Fast colorful strobing
# Rapid color changes with strobe effects
#strip length 60
# Define disco color palette
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var disco_colors_ = bytes(
"00FF0000" # Red
"2AFF8000" # Orange
"55FFFF00" # Yellow
"8000FF00" # Green
"AA0000FF" # Blue
"D58000FF" # Purple
"FFFF00FF" # Magenta
)
# Fast color cycling base
var disco_rich_color_ = animation.rich_palette(engine)
disco_rich_color_.palette = disco_colors_
disco_rich_color_.cycle_period = 1000
disco_rich_color_.transition_type = animation.LINEAR
disco_rich_color_.brightness = 255
var disco_base_ = animation.solid(engine)
disco_base_.color = disco_rich_color_
# Add strobe effect
disco_base_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 255
provider.duration = 100
provider.duty_cycle = 30
return provider
end)(engine) # Fast strobe
# Add white flash overlay
var white_flash_ = animation.solid(engine)
white_flash_.color = 0xFFFFFFFF
white_flash_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 255
provider.duration = 50
provider.duty_cycle = 10
return provider
end)(engine) # Quick white flashes
white_flash_.priority = 20
# Add colored sparkles
var sparkle_pattern_ = animation.rich_palette(engine)
sparkle_pattern_.palette = disco_colors_
sparkle_pattern_.cycle_period = 500
sparkle_pattern_.transition_type = animation.LINEAR
sparkle_pattern_.brightness = 255
var disco_sparkles_ = animation.twinkle_animation(engine)
disco_sparkles_.color = sparkle_pattern_ # color source
disco_sparkles_.density = 12 # density (many sparkles)
disco_sparkles_.twinkle_speed = 80 # twinkle speed (very quick)
disco_sparkles_.priority = 15
# Add moving pulse for extra effect
var pulse_pattern_ = animation.rich_palette(engine)
pulse_pattern_.palette = disco_colors_
pulse_pattern_.cycle_period = 800
pulse_pattern_.transition_type = animation.LINEAR
pulse_pattern_.brightness = 255
var disco_pulse_ = animation.beacon_animation(engine)
disco_pulse_.color = pulse_pattern_ # color source
disco_pulse_.pos = 4 # initial position
disco_pulse_.beacon_size = 8 # pulse width
disco_pulse_.slew_size = 2 # sharp edges (slew size)
disco_pulse_.priority = 10
disco_pulse_.pos = (def (engine)
var provider = animation.sawtooth(engine)
provider.min_value = 4
provider.max_value = 56
provider.duration = 2000
return provider
end)(engine) # Fast movement
# Start all animations
engine.add(disco_base_)
engine.add(white_flash_)
engine.add(disco_sparkles_)
engine.add(disco_pulse_)
engine.run()
#- Original DSL source:
# Disco Strobe - Fast colorful strobing
# Rapid color changes with strobe effects
#strip length 60
# Define disco color palette
palette disco_colors = [
(0, 0xFF0000), # Red
(42, 0xFF8000), # Orange
(85, 0xFFFF00), # Yellow
(128, 0x00FF00), # Green
(170, 0x0000FF), # Blue
(213, 0x8000FF), # Purple
(255, 0xFF00FF) # Magenta
]
# Fast color cycling base
color disco_rich_color = rich_palette(palette=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
animation disco_base = solid(color=disco_rich_color)
# Add strobe effect
disco_base.opacity = square(min_value=0, max_value=255, duration=100ms, duty_cycle=30) # Fast strobe
# Add white flash overlay
animation white_flash = solid(color=0xFFFFFF)
white_flash.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cycle=10) # Quick white flashes
white_flash.priority = 20
# Add colored sparkles
color sparkle_pattern = rich_palette(palette=disco_colors, cycle_period=500ms, transition_type=LINEAR, brightness=255)
animation disco_sparkles = twinkle_animation(
color=sparkle_pattern # color source
density=12 # density (many sparkles)
twinkle_speed=80ms # twinkle speed (very quick)
)
disco_sparkles.priority = 15
# Add moving pulse for extra effect
color pulse_pattern = rich_palette(palette=disco_colors, cycle_period=800ms, transition_type=LINEAR, brightness=255)
animation disco_pulse = beacon_animation(
color=pulse_pattern # color source
pos=4 # initial position
beacon_size=8 # pulse width
slew_size=2 # sharp edges (slew size)
)
disco_pulse.priority = 10
disco_pulse.pos = sawtooth(min_value=4, max_value=56, duration=2s) # Fast movement
# Start all animations
run disco_base
run white_flash
run disco_sparkles
run disco_pulse
-#