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

114 lines
4.2 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: disco_strobe.anim
# Generated automatically
#
# This file was automatically generated by compile_all_dsl_examples.sh
# Do not edit manually - changes will be overwritten
# 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
# 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
import animation
# Disco Strobe - Fast colorful strobing
# Rapid color changes with strobe effects
var strip = global.Leds(60)
var engine = animation.create_engine(strip)
# Define disco color palette
var disco_colors_ = bytes("00FF0000" "2AFF8000" "55FFFF00" "8000FF00" "AA0000FF" "D58000FF" "FFFF00FF")
# Fast color cycling base
var disco_base_ = animation.rich_palette_animation(animation.global('disco_colors_', 'disco_colors'), 1000, animation.global('linear_', 'linear'), 255)
# Add strobe effect
animation.global('disco_base_').opacity = animation.square(0, 255, 100, 30) # Fast strobe
# Add white flash overlay
var white_flash_ = animation.solid(0xFFFFFFFF)
animation.global('white_flash_').opacity = animation.square(0, 255, 50, 10) # Quick white flashes
animation.global('white_flash_').priority = 20
# Add colored sparkles
var sparkle_pattern_ = animation.rich_palette_color_provider(animation.global('disco_colors_', 'disco_colors'), 500, animation.global('linear_', 'linear'), 255)
var disco_sparkles_ = animation.twinkle_animation(animation.global('sparkle_pattern_', 'sparkle_pattern'), 12, 80)
animation.global('disco_sparkles_').priority = 15
# Add moving pulse for extra effect
var pulse_pattern_ = animation.rich_palette_color_provider(animation.global('disco_colors_', 'disco_colors'), 800, animation.global('linear_', 'linear'), 255)
var disco_pulse_ = animation.pulse_position_animation(animation.global('pulse_pattern_', 'pulse_pattern'), 4, 8, 2)
animation.global('disco_pulse_').priority = 10
animation.global('disco_pulse_').pos = animation.sawtooth(4, 56, 2000) # Fast movement
# Start all animations
# Start all animations/sequences
if global.contains('sequence_disco_base')
var seq_manager = global.sequence_disco_base()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('disco_base_'))
end
if global.contains('sequence_white_flash')
var seq_manager = global.sequence_white_flash()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('white_flash_'))
end
if global.contains('sequence_disco_sparkles')
var seq_manager = global.sequence_disco_sparkles()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('disco_sparkles_'))
end
if global.contains('sequence_disco_pulse')
var seq_manager = global.sequence_disco_pulse()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('disco_pulse_'))
end
engine.start()