Tasmota/lib/libesp32/berry_animation/anim_examples/compiled/disco_strobe.be

129 lines
4.6 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: disco_strobe.anim
# Generated automatically
#
# This file was automatically generated by compile_all_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(palette=disco_colors, cycle_period=1s, transition_type=LINEAR, brightness=255)
#
# # 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
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" "2AFF8000" "55FFFF00" "8000FF00" "AA0000FF" "D58000FF" "FFFF00FF")
# Fast color cycling base
var disco_base_ = animation.rich_palette_animation(engine)
disco_base_.palette = disco_colors_
disco_base_.cycle_period = 1000
disco_base_.transition_type = animation.LINEAR
disco_base_.brightness = 255
# Add strobe effect
var temp_square_105 = animation.square(engine)
temp_square_105.min_value = 0
temp_square_105.max_value = 255
temp_square_105.duration = 100
temp_square_105.duty_cycle = 30
disco_base_.opacity = temp_square_105 # Fast strobe
# Add white flash overlay
var white_flash_ = animation.solid(engine)
white_flash_.color = 0xFFFFFFFF
var temp_square_142 = animation.square(engine)
temp_square_142.min_value = 0
temp_square_142.max_value = 255
temp_square_142.duration = 50
temp_square_142.duty_cycle = 10
white_flash_.opacity = temp_square_142 # 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
var temp_sawtooth_285 = animation.sawtooth(engine)
temp_sawtooth_285.min_value = 4
temp_sawtooth_285.max_value = 56
temp_sawtooth_285.duration = 2000
disco_pulse_.pos = temp_sawtooth_285 # Fast movement
# Start all animations
engine.add_animation(disco_base_)
engine.add_animation(white_flash_)
engine.add_animation(disco_sparkles_)
engine.add_animation(disco_pulse_)
engine.start()