141 lines
4.8 KiB
Plaintext
141 lines
4.8 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: neon_glow.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:
|
|
# # 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(neon_colors, 4s, linear, 255)
|
|
#
|
|
# # Add electrical flickering
|
|
# neon_main.opacity = smooth(220, 255, 200ms)
|
|
#
|
|
# # Add occasional electrical surge
|
|
# animation neon_surge = solid(0xFFFFFF) # White surge
|
|
# neon_surge.opacity = square(0, 255, 50ms, 2) # Quick bright surges
|
|
# neon_surge.priority = 20
|
|
#
|
|
# # Add neon tube segments with gaps
|
|
# pattern segment_pattern = rich_palette_color_provider(neon_colors, 4s, linear, 255)
|
|
# animation segment1 = pulse_position_animation(
|
|
# segment_pattern, # color source
|
|
# 6, # position
|
|
# 12, # segment length
|
|
# 1 # sharp edges
|
|
# )
|
|
# segment1.priority = 10
|
|
#
|
|
# animation segment2 = pulse_position_animation(
|
|
# segment_pattern, # color source
|
|
# 24, # position
|
|
# 12, # segment length
|
|
# 1 # sharp edges
|
|
# )
|
|
# segment2.priority = 10
|
|
#
|
|
# animation segment3 = pulse_position_animation(
|
|
# segment_pattern, # color source
|
|
# 42, # position
|
|
# 12, # segment length
|
|
# 1 # sharp edges
|
|
# )
|
|
# segment3.priority = 10
|
|
#
|
|
# # Add electrical arcing between segments
|
|
# animation arc_sparkles = twinkle_animation(
|
|
# 0xAAAAFF, # Electric blue
|
|
# 4, # density (few arcs)
|
|
# 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
|
|
|
|
import animation
|
|
|
|
# Neon Glow - Electric neon tube effect
|
|
# Bright saturated colors with flickering
|
|
var strip = global.Leds(60)
|
|
var engine = animation.create_engine(strip)
|
|
# Define neon colors
|
|
var neon_colors_ = bytes("00FF0080" "5500FF80" "AA8000FF" "FFFF8000")
|
|
# Main neon glow with color cycling
|
|
var neon_main_ = animation.rich_palette_animation(animation.global('neon_colors_', 'neon_colors'), 4000, animation.global('linear_', 'linear'), 255)
|
|
# Add electrical flickering
|
|
animation.global('neon_main_').opacity = animation.smooth(220, 255, 200)
|
|
# Add occasional electrical surge
|
|
var neon_surge_ = animation.solid(0xFFFFFFFF) # White surge
|
|
animation.global('neon_surge_').opacity = animation.square(0, 255, 50, 2) # Quick bright surges
|
|
animation.global('neon_surge_').priority = 20
|
|
# Add neon tube segments with gaps
|
|
var segment_pattern_ = animation.rich_palette_color_provider(animation.global('neon_colors_', 'neon_colors'), 4000, animation.global('linear_', 'linear'), 255)
|
|
var segment1_ = animation.pulse_position_animation(animation.global('segment_pattern_', 'segment_pattern'), 6, 12, 1)
|
|
animation.global('segment1_').priority = 10
|
|
var segment2_ = animation.pulse_position_animation(animation.global('segment_pattern_', 'segment_pattern'), 24, 12, 1)
|
|
animation.global('segment2_').priority = 10
|
|
var segment3_ = animation.pulse_position_animation(animation.global('segment_pattern_', 'segment_pattern'), 42, 12, 1)
|
|
animation.global('segment3_').priority = 10
|
|
# Add electrical arcing between segments
|
|
var arc_sparkles_ = animation.twinkle_animation(0xFFAAAAFF, 4, 100)
|
|
animation.global('arc_sparkles_').priority = 15
|
|
# Start all animations
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_neon_main')
|
|
var seq_manager = global.sequence_neon_main()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('neon_main_'))
|
|
end
|
|
if global.contains('sequence_neon_surge')
|
|
var seq_manager = global.sequence_neon_surge()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('neon_surge_'))
|
|
end
|
|
if global.contains('sequence_segment1')
|
|
var seq_manager = global.sequence_segment1()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('segment1_'))
|
|
end
|
|
if global.contains('sequence_segment2')
|
|
var seq_manager = global.sequence_segment2()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('segment2_'))
|
|
end
|
|
if global.contains('sequence_segment3')
|
|
var seq_manager = global.sequence_segment3()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('segment3_'))
|
|
end
|
|
if global.contains('sequence_arc_sparkles')
|
|
var seq_manager = global.sequence_arc_sparkles()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('arc_sparkles_'))
|
|
end
|
|
engine.start()
|