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

107 lines
3.5 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: comet_chase.anim
# Generated automatically
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
# Original DSL source:
# # Comet Chase - Moving comet with trailing tail
# # Bright head with fading tail
#
# #strip length 60
#
# # Dark blue background
# color space_blue = 0x000066 # Note: opaque 0xFF alpha channel is implicitly added
# animation background = solid(color=space_blue)
#
# # Main comet with bright white head
# animation comet_main = comet_animation(
# color=0xFFFFFF, # White head
# tail_length=10, # tail length
# speed=2s # speed
# )
# comet_main.priority = 7
#
# # Secondary comet in different color, opposite direction
# animation comet_secondary = comet_animation(
# color=0xFF4500, # Orange head
# tail_length=8, # shorter tail
# speed=3s, # slower speed
# direction=-1 # other direction
# )
# comet_secondary.priority = 5
#
# # Add sparkle trail behind comets but on top of blue background
# animation comet_sparkles = twinkle_animation(
# color=0xAAAAFF, # Light blue sparkles
# density=8, # density (moderate sparkles)
# twinkle_speed=400ms # twinkle speed (quick sparkle)
# )
# comet_sparkles.priority = 8
#
# # Start all animations
# run background
# run comet_main
# run comet_secondary
# run comet_sparkles
import animation
# Comet Chase - Moving comet with trailing tail
# Bright head with fading tail
#strip length 60
# Dark blue background
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var space_blue_ = 0xFF000066 # Note: opaque 0xFF alpha channel is implicitly added
var background_ = animation.solid(engine)
background_.color = animation.global('space_blue_', 'space_blue')
# Main comet with bright white head
var comet_main_ = animation.comet_animation(engine)
comet_main_.color = 0xFFFFFFFF
comet_main_.tail_length = 10
comet_main_.speed = 2000 # speed
animation.global('comet_main_').priority = 7
# Secondary comet in different color, opposite direction
var comet_secondary_ = animation.comet_animation(engine)
comet_secondary_.color = 0xFFFF4500
comet_secondary_.tail_length = 8
comet_secondary_.speed = 3000
comet_secondary_.direction = -1 # other direction
animation.global('comet_secondary_').priority = 5
# Add sparkle trail behind comets but on top of blue background
var comet_sparkles_ = animation.twinkle_animation(engine)
comet_sparkles_.color = 0xFFAAAAFF
comet_sparkles_.density = 8
comet_sparkles_.twinkle_speed = 400 # twinkle speed (quick sparkle)
animation.global('comet_sparkles_').priority = 8
# Start all animations
# Start all animations/sequences
if global.contains('sequence_background')
var seq_manager = global.sequence_background()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('background_'))
end
if global.contains('sequence_comet_main')
var seq_manager = global.sequence_comet_main()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('comet_main_'))
end
if global.contains('sequence_comet_secondary')
var seq_manager = global.sequence_comet_secondary()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('comet_secondary_'))
end
if global.contains('sequence_comet_sparkles')
var seq_manager = global.sequence_comet_sparkles()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('comet_sparkles_'))
end
engine.start()