84 lines
2.5 KiB
Plaintext
84 lines
2.5 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: twinkle_stars.anim
|
|
# Generated automatically
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
# Original DSL source:
|
|
# # Twinkle Stars - Random sparkling white stars
|
|
# # White sparkles on dark blue background
|
|
#
|
|
# #strip length 60
|
|
#
|
|
# # Dark blue background
|
|
# color night_sky = 0x000033
|
|
# animation background = solid(color=night_sky)
|
|
#
|
|
# # White twinkling stars
|
|
# animation stars = twinkle_animation(
|
|
# color=0xFFFFFF, # White stars
|
|
# density=8, # density (number of stars)
|
|
# twinkle_speed=500ms # twinkle speed (twinkle duration)
|
|
# )
|
|
# stars.priority = 10
|
|
#
|
|
# # Add occasional bright flash
|
|
# animation bright_flash = twinkle_animation(
|
|
# color=0xFFFFAA, # Bright yellow-white
|
|
# density=2, # density (fewer bright flashes)
|
|
# twinkle_speed=300ms # twinkle speed (quick flash)
|
|
# )
|
|
# bright_flash.priority = 15
|
|
#
|
|
# # Start all animations
|
|
# run background
|
|
# run stars
|
|
# run bright_flash
|
|
|
|
import animation
|
|
|
|
# Twinkle Stars - Random sparkling white stars
|
|
# White sparkles on dark blue background
|
|
#strip length 60
|
|
# Dark blue background
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var night_sky_ = 0xFF000033
|
|
var background_ = animation.solid(engine)
|
|
background_.color = animation.global('night_sky_', 'night_sky')
|
|
# White twinkling stars
|
|
var stars_ = animation.twinkle_animation(engine)
|
|
stars_.color = 0xFFFFFFFF
|
|
stars_.density = 8
|
|
stars_.twinkle_speed = 500 # twinkle speed (twinkle duration)
|
|
animation.global('stars_').priority = 10
|
|
# Add occasional bright flash
|
|
var bright_flash_ = animation.twinkle_animation(engine)
|
|
bright_flash_.color = 0xFFFFFFAA
|
|
bright_flash_.density = 2
|
|
bright_flash_.twinkle_speed = 300 # twinkle speed (quick flash)
|
|
animation.global('bright_flash_').priority = 15
|
|
# 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_stars')
|
|
var seq_manager = global.sequence_stars()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stars_'))
|
|
end
|
|
if global.contains('sequence_bright_flash')
|
|
var seq_manager = global.sequence_bright_flash()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('bright_flash_'))
|
|
end
|
|
engine.start()
|