Tasmota/lib/libesp32/berry_animation/anim_examples/compiled/fire_flicker.be

90 lines
3.3 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: fire_flicker.anim
# Generated automatically
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
# 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
# animation fire_base = rich_palette_animation(palette=fire_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
#
# # 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
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" "40800000" "80FF0000" "C0FF4500" "FFFFFF00")
# Create base fire animation with palette
var fire_base_ = animation.rich_palette_animation(engine)
fire_base_.palette = animation.global('fire_colors_', 'fire_colors')
fire_base_.cycle_period = 3000
fire_base_.transition_type = animation.global('LINEAR_', 'LINEAR')
fire_base_.brightness = 255
# Add flickering effect with random intensity changes
var temp_smooth_89 = animation.smooth(engine)
temp_smooth_89.min_value = 180
temp_smooth_89.max_value = 255
temp_smooth_89.duration = 800
animation.global('fire_base_').opacity = temp_smooth_89
# Add subtle position variation for more realism
var flicker_pattern_ = animation.rich_palette(engine)
flicker_pattern_.palette = animation.global('fire_colors_', 'fire_colors')
flicker_pattern_.cycle_period = 2000
flicker_pattern_.transition_type = animation.global('LINEAR_', 'LINEAR')
flicker_pattern_.brightness = 255
var fire_flicker_ = animation.twinkle_animation(engine)
fire_flicker_.color = animation.global('flicker_pattern_', 'flicker_pattern')
fire_flicker_.density = 12
fire_flicker_.twinkle_speed = 200 # twinkle speed (flicker duration)
animation.global('fire_flicker_').priority = 10
# Start both animations
# Start all animations/sequences
if global.contains('sequence_fire_base')
var seq_manager = global.sequence_fire_base()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('fire_base_'))
end
if global.contains('sequence_fire_flicker')
var seq_manager = global.sequence_fire_flicker()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('fire_flicker_'))
end
engine.start()