Tasmota/lib/libesp32/berry_animation/anim_examples/compiled/simple_palette.be
2025-08-01 23:19:24 +02:00

58 lines
1.5 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: simple_palette.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:
# # Simple Palette Example
# # Demonstrates basic palette usage in the DSL
#
# strip length 20
#
# # Define a simple rainbow palette
# palette rainbow = [
# (0, red),
# (64, orange),
# (128, yellow),
# (192, green),
# (255, blue)
# ]
#
# # Create an animation using the palette
# animation rainbow_cycle = rich_palette_animation(rainbow, 3s)
#
# # Simple sequence
# sequence demo {
# play rainbow_cycle for 15s
# }
#
# run demo
import animation
# Simple Palette Example
# Demonstrates basic palette usage in the DSL
var engine = animation.init_strip(20)
# Define a simple rainbow palette
var rainbow_ = bytes("00FF0000" "40FFA500" "80FFFF00" "C0008000" "FF0000FF")
# Create an animation using the palette
var rainbow_cycle_ = animation.rich_palette_animation(animation.global('rainbow_', 'rainbow'), 3000)
# Simple sequence
def sequence_demo()
var steps = []
steps.push(animation.create_play_step(animation.global('rainbow_cycle_'), 15000))
var seq_manager = animation.SequenceManager(engine)
seq_manager.start_sequence(steps)
return seq_manager
end
# Start all animations/sequences
if global.contains('sequence_demo')
var seq_manager = global.sequence_demo()
engine.add_sequence_manager(seq_manager)
else
engine.add_animation(animation.global('demo_'))
end
engine.start()