Tasmota/lib/libesp32/berry_animation/anim_examples/sunrise_sunset.anim
2025-08-01 19:34:23 +02:00

57 lines
1.6 KiB
Plaintext

# 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