Files
2025-09-03 22:10:31 +02:00

156 lines
4.7 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: neon_glow.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
import animation
# Neon Glow - Electric neon tube effect
# Bright saturated colors with flickering
#strip length 60
# Define neon colors
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var neon_colors_ = bytes(
"00FF0080" # Hot pink
"5500FF80" # Neon green
"AA8000FF" # Electric purple
"FFFF8000" # Neon orange
)
# Main neon glow with color cycling
var neon_main_ = animation.rich_palette_animation(engine)
neon_main_.palette = neon_colors_
neon_main_.cycle_period = 4000
neon_main_.transition_type = animation.LINEAR
neon_main_.brightness = 255
# Add electrical flickering
neon_main_.opacity = (def (engine)
var provider = animation.smooth(engine)
provider.min_value = 220
provider.max_value = 255
provider.duration = 200
return provider
end)(engine)
# Add occasional electrical surge
var neon_surge_ = animation.solid(engine)
neon_surge_.color = 0xFFFFFFFF
# White surge
neon_surge_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 255
provider.duration = 50
provider.duty_cycle = 2
return provider
end)(engine) # Quick bright surges
neon_surge_.priority = 20
# Add neon tube segments with gaps
var segment_pattern_ = animation.rich_palette(engine)
segment_pattern_.palette = neon_colors_
segment_pattern_.cycle_period = 4000
segment_pattern_.transition_type = animation.LINEAR
segment_pattern_.brightness = 255
var segment1_ = animation.beacon_animation(engine)
segment1_.color = segment_pattern_ # color source
segment1_.pos = 6 # position
segment1_.beacon_size = 12 # segment length
segment1_.slew_size = 1 # sharp edges
segment1_.priority = 10
var segment2_ = animation.beacon_animation(engine)
segment2_.color = segment_pattern_ # color source
segment2_.pos = 24 # position
segment2_.beacon_size = 12 # segment length
segment2_.slew_size = 1 # sharp edges
segment2_.priority = 10
var segment3_ = animation.beacon_animation(engine)
segment3_.color = segment_pattern_ # color source
segment3_.pos = 42 # position
segment3_.beacon_size = 12 # segment length
segment3_.slew_size = 1 # sharp edges
segment3_.priority = 10
# Add electrical arcing between segments
var arc_sparkles_ = animation.twinkle_animation(engine)
arc_sparkles_.color = 0xFFAAAAFF # Electric blue
arc_sparkles_.density = 4 # density (few arcs)
arc_sparkles_.twinkle_speed = 100 # twinkle speed (quick arcs)
arc_sparkles_.priority = 15
# Start all animations
engine.add(neon_main_)
engine.add(neon_surge_)
engine.add(segment1_)
engine.add(segment2_)
engine.add(segment3_)
engine.add(arc_sparkles_)
engine.run()
#- Original DSL source:
# Neon Glow - Electric neon tube effect
# Bright saturated colors with flickering
#strip length 60
# Define neon colors
palette neon_colors = [
(0, 0xFF0080), # Hot pink
(85, 0x00FF80), # Neon green
(170, 0x8000FF), # Electric purple
(255, 0xFF8000) # Neon orange
]
# Main neon glow with color cycling
animation neon_main = rich_palette_animation(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
# Add electrical flickering
neon_main.opacity = smooth(min_value=220, max_value=255, duration=200ms)
# Add occasional electrical surge
animation neon_surge = solid(color=0xFFFFFF) # White surge
neon_surge.opacity = square(min_value=0, max_value=255, duration=50ms, duty_cycle=2) # Quick bright surges
neon_surge.priority = 20
# Add neon tube segments with gaps
color segment_pattern = rich_palette(palette=neon_colors, cycle_period=4s, transition_type=LINEAR, brightness=255)
animation segment1 = beacon_animation(
color=segment_pattern # color source
pos=6 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment1.priority = 10
animation segment2 = beacon_animation(
color=segment_pattern # color source
pos=24 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment2.priority = 10
animation segment3 = beacon_animation(
color=segment_pattern # color source
pos=42 # position
beacon_size=12 # segment length
slew_size=1 # sharp edges
)
segment3.priority = 10
# Add electrical arcing between segments
animation arc_sparkles = twinkle_animation(
color=0xAAAAFF # Electric blue
density=4 # density (few arcs)
twinkle_speed=100ms # twinkle speed (quick arcs)
)
arc_sparkles.priority = 15
# Start all animations
run neon_main
run neon_surge
run segment1
run segment2
run segment3
run arc_sparkles
-#