mirror of
https://github.com/arendst/Tasmota.git
synced 2025-11-30 13:17:44 +00:00
72 lines
2.6 KiB
Plaintext
72 lines
2.6 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: fire_flicker.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:
|
|
# # 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(fire_colors, 3s, linear, 255)
|
|
#
|
|
# # Add flickering effect with random intensity changes
|
|
# fire_base.opacity = smooth(180, 255, 800ms)
|
|
#
|
|
# # Add subtle position variation for more realism
|
|
# pattern flicker_pattern = rich_palette_color_provider(fire_colors, 2s, linear, 255)
|
|
# animation fire_flicker = twinkle_animation(
|
|
# flicker_pattern, # color source
|
|
# 12, # density (number of flickers)
|
|
# 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
|
|
var engine = animation.init_strip(60)
|
|
# Define fire palette from black to yellow
|
|
var fire_colors_ = bytes("00000000" "40800000" "80FF0000" "C0FF4500" "FFFFFF00")
|
|
# Create base fire animation with palette
|
|
var fire_base_ = animation.rich_palette_animation(animation.global('fire_colors_', 'fire_colors'), 3000, animation.global('linear_', 'linear'), 255)
|
|
# Add flickering effect with random intensity changes
|
|
animation.global('fire_base_').opacity = animation.smooth(180, 255, 800)
|
|
# Add subtle position variation for more realism
|
|
var flicker_pattern_ = animation.rich_palette_color_provider(animation.global('fire_colors_', 'fire_colors'), 2000, animation.global('linear_', 'linear'), 255)
|
|
var fire_flicker_ = animation.twinkle_animation(animation.global('flicker_pattern_', 'flicker_pattern'), 12, 200)
|
|
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()
|