118 lines
4.2 KiB
Plaintext
118 lines
4.2 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: sunrise_sunset.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:
|
|
# # Sunrise Sunset - Warm color transition
|
|
# # Gradual transition from night to day colors
|
|
#
|
|
# strip length 60
|
|
#
|
|
# # Define time-of-day color palette
|
|
# palette daylight_colors = [
|
|
# (0, 0x000011), # Night - dark blue
|
|
# (32, 0x001133), # Pre-dawn
|
|
# (64, 0xFF4400), # Sunrise orange
|
|
# (96, 0xFFAA00), # Morning yellow
|
|
# (128, 0xFFFF88), # Midday bright
|
|
# (160, 0xFFAA44), # Afternoon
|
|
# (192, 0xFF6600), # Sunset orange
|
|
# (224, 0xAA2200), # Dusk red
|
|
# (255, 0x220011) # Night - dark red
|
|
# ]
|
|
#
|
|
# # Main daylight cycle - very slow transition
|
|
# animation daylight_cycle = rich_palette_animation(daylight_colors, 60s)
|
|
#
|
|
# # Add sun position effect - bright spot that moves
|
|
# animation sun_position = pulse_position_animation(
|
|
# 0xFFFFAA, # Bright yellow sun
|
|
# 5, # initial position
|
|
# 8, # sun size
|
|
# 4 # soft glow
|
|
# )
|
|
# sun_position.priority = 10
|
|
# sun_position.pos = smooth(5, 55, 30s) # Sun arc across sky
|
|
# sun_position.opacity = smooth(0, 255, 30s) # Fade in and out
|
|
#
|
|
# # Add atmospheric glow around sun
|
|
# animation sun_glow = pulse_position_animation(
|
|
# 0xFFCC88, # Warm glow
|
|
# 5, # initial position
|
|
# 16, # larger glow
|
|
# 8 # very soft
|
|
# )
|
|
# sun_glow.priority = 5
|
|
# sun_glow.pos = smooth(5, 55, 30s) # Follow sun
|
|
# sun_glow.opacity = smooth(0, 150, 30s) # Dimmer glow
|
|
#
|
|
# # Add twinkling stars during night phases
|
|
# animation stars = twinkle_animation(
|
|
# 0xFFFFFF, # White stars
|
|
# 6, # density (star count)
|
|
# 1s # twinkle speed (slow twinkle)
|
|
# )
|
|
# stars.priority = 15
|
|
# stars.opacity = smooth(255, 0, 30s) # Fade out during day
|
|
#
|
|
# # Start all animations
|
|
# run daylight_cycle
|
|
# run sun_position
|
|
# run sun_glow
|
|
# run stars
|
|
|
|
import animation
|
|
|
|
# Sunrise Sunset - Warm color transition
|
|
# Gradual transition from night to day colors
|
|
var strip = global.Leds(60)
|
|
var engine = animation.create_engine(strip)
|
|
# Define time-of-day color palette
|
|
var daylight_colors_ = bytes("00000011" "20001133" "40FF4400" "60FFAA00" "80FFFF88" "A0FFAA44" "C0FF6600" "E0AA2200" "FF220011")
|
|
# Main daylight cycle - very slow transition
|
|
var daylight_cycle_ = animation.rich_palette_animation(animation.global('daylight_colors_', 'daylight_colors'), 60000)
|
|
# Add sun position effect - bright spot that moves
|
|
var sun_position_ = animation.pulse_position_animation(0xFFFFFFAA, 5, 8, 4)
|
|
animation.global('sun_position_').priority = 10
|
|
animation.global('sun_position_').pos = animation.smooth(5, 55, 30000) # Sun arc across sky
|
|
animation.global('sun_position_').opacity = animation.smooth(0, 255, 30000) # Fade in and out
|
|
# Add atmospheric glow around sun
|
|
var sun_glow_ = animation.pulse_position_animation(0xFFFFCC88, 5, 16, 8)
|
|
animation.global('sun_glow_').priority = 5
|
|
animation.global('sun_glow_').pos = animation.smooth(5, 55, 30000) # Follow sun
|
|
animation.global('sun_glow_').opacity = animation.smooth(0, 150, 30000) # Dimmer glow
|
|
# Add twinkling stars during night phases
|
|
var stars_ = animation.twinkle_animation(0xFFFFFFFF, 6, 1000)
|
|
animation.global('stars_').priority = 15
|
|
animation.global('stars_').opacity = animation.smooth(255, 0, 30000) # Fade out during day
|
|
# Start all animations
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_daylight_cycle')
|
|
var seq_manager = global.sequence_daylight_cycle()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('daylight_cycle_'))
|
|
end
|
|
if global.contains('sequence_sun_position')
|
|
var seq_manager = global.sequence_sun_position()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('sun_position_'))
|
|
end
|
|
if global.contains('sequence_sun_glow')
|
|
var seq_manager = global.sequence_sun_glow()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('sun_glow_'))
|
|
end
|
|
if global.contains('sequence_stars')
|
|
var seq_manager = global.sequence_stars()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stars_'))
|
|
end
|
|
engine.start()
|