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

57 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_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(palette=rainbow, cycle_period=3s)
#
# # Simple sequence
# sequence demo {
# play rainbow_cycle for 15s
# }
#
# run demo
import animation
# Simple Palette Example
# Demonstrates basic palette usage in the DSL
#strip length 20
# Define a simple rainbow palette
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var rainbow_ = bytes("00FF0000" "40FFA500" "80FFFF00" "C0008000" "FF0000FF")
# Create an animation using the palette
var rainbow_cycle_ = animation.rich_palette_animation(engine)
rainbow_cycle_.palette = rainbow_
rainbow_cycle_.cycle_period = 3000
# Simple sequence
var demo_ = (def (engine)
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)(engine)
engine.add_sequence_manager(demo_)
engine.start()