mirror of
https://github.com/arendst/Tasmota.git
synced 2025-11-28 04:07:44 +00:00
91 lines
2.9 KiB
Plaintext
91 lines
2.9 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: fire_flicker.anim
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
import animation
|
|
|
|
# Fire Flicker - Realistic fire simulation
|
|
# Warm colors with random flickering intensity
|
|
#strip length 60
|
|
# Define fire palette from black to yellow
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var fire_colors_ = bytes(
|
|
"00000000" # Black
|
|
"40800000" # Dark red
|
|
"80FF0000" # Red
|
|
"C0FF4500" # Orange red
|
|
"FFFFFF00" # Yellow
|
|
)
|
|
# Create base fire animation with palette
|
|
var fire_base_color_ = animation.rich_palette(engine)
|
|
fire_base_color_.palette = fire_colors_
|
|
fire_base_color_.cycle_period = 3000
|
|
fire_base_color_.transition_type = animation.LINEAR
|
|
fire_base_color_.brightness = 255
|
|
var fire_base_ = animation.solid(engine)
|
|
fire_base_.color = fire_base_color_
|
|
# Add flickering effect with random intensity changes
|
|
fire_base_.opacity = (def (engine)
|
|
var provider = animation.smooth(engine)
|
|
provider.min_value = 180
|
|
provider.max_value = 255
|
|
provider.duration = 800
|
|
return provider
|
|
end)(engine)
|
|
# Add subtle position variation for more realism
|
|
var flicker_pattern_ = animation.rich_palette(engine)
|
|
flicker_pattern_.palette = fire_colors_
|
|
flicker_pattern_.cycle_period = 2000
|
|
flicker_pattern_.transition_type = animation.LINEAR
|
|
flicker_pattern_.brightness = 255
|
|
var fire_flicker_ = animation.twinkle_animation(engine)
|
|
fire_flicker_.color = flicker_pattern_ # color source
|
|
fire_flicker_.density = 12 # density (number of flickers)
|
|
fire_flicker_.twinkle_speed = 200 # twinkle speed (flicker duration)
|
|
fire_flicker_.priority = 10
|
|
# Start both animations
|
|
engine.add(fire_base_)
|
|
engine.add(fire_flicker_)
|
|
engine.run()
|
|
|
|
|
|
#- Original DSL source:
|
|
# 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(palette=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(palette=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
|
|
-#
|