Tasmota/lib/libesp32/berry_animation/anim_examples/disco_strobe.anim
2025-08-01 19:34:23 +02:00

52 lines
1.5 KiB
Plaintext

# 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
animation disco_base = rich_palette_animation(disco_colors, 1s, linear, 255)
# Add strobe effect
disco_base.opacity = square(0, 255, 100ms, 30) # Fast strobe
# Add white flash overlay
animation white_flash = solid(0xFFFFFF)
white_flash.opacity = square(0, 255, 50ms, 10) # Quick white flashes
white_flash.priority = 20
# Add colored sparkles
pattern sparkle_pattern = rich_palette_color_provider(disco_colors, 500ms, linear, 255)
animation disco_sparkles = twinkle_animation(
sparkle_pattern, # color source
12, # density (many sparkles)
80ms # twinkle speed (very quick)
)
disco_sparkles.priority = 15
# Add moving pulse for extra effect
pattern pulse_pattern = rich_palette_color_provider(disco_colors, 800ms, linear, 255)
animation disco_pulse = pulse_position_animation(
pulse_pattern, # color source
4, # initial position
8, # pulse width
2 # sharp edges (slew size)
)
disco_pulse.priority = 10
disco_pulse.pos = sawtooth(4, 56, 2s) # Fast movement
# Start all animations
run disco_base
run white_flash
run disco_sparkles
run disco_pulse