33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
# Fire Flicker - Realistic fire simulation
|
|
# Warm colors with random flickering intensity
|
|
|
|
#strip length 60
|
|
|
|
# Define fire palette from black to yellow
|
|
palette fire_colors = [
|
|
(0, 0x000000), # Black
|
|
(64, 0x800000), # Dark red
|
|
(128, 0xFF0000), # Red
|
|
(192, 0xFF4500), # Orange red
|
|
(255, 0xFFFF00) # Yellow
|
|
]
|
|
|
|
# Create base fire animation with palette
|
|
color fire_base_color = rich_palette(colors=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
|
|
animation fire_base = solid(color=fire_base_color)
|
|
|
|
# Add flickering effect with random intensity changes
|
|
fire_base.opacity = smooth(min_value=180, max_value=255, duration=800ms)
|
|
|
|
# Add subtle position variation for more realism
|
|
color flicker_pattern = rich_palette(colors=fire_colors, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
|
animation fire_flicker = twinkle_animation(
|
|
color=flicker_pattern # color source
|
|
density=12 # density (number of flickers)
|
|
twinkle_speed=200ms # twinkle speed (flicker duration)
|
|
)
|
|
fire_flicker.priority = 10
|
|
|
|
# Start both animations
|
|
run fire_base
|
|
run fire_flicker |