Tasmota/lib/libesp32/berry_animation/anim_examples/test_template_animation.anim

62 lines
1.5 KiB
Plaintext

# Test Template Animation
# Simple test to verify template animation syntax
template animation shutter_central {
param colors type palette
param period type time
set strip_len = strip_length()
set strip_len2 = (strip_len + 1) / 2
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
color col1 = color_cycle(colors=colors, period=0)
color col2 = color_cycle(colors=colors, period=0)
col2.next = 1
# shutter moving in to out
animation shutter_inout_animation = beacon_animation(
color = col2
back_color = col1
pos = strip_len2 - (shutter_size + 1) / 2
beacon_size = shutter_size
slew_size = 0
priority = 5
)
# shutter moving out to in
animation shutter_outin_animation = beacon_animation(
color = col1
back_color = col2
pos = strip_len2 - (strip_len - shutter_size + 1) / 2
beacon_size = strip_len - shutter_size
slew_size = 0
priority = 5
)
sequence shutter_seq repeat forever {
repeat col1.palette_size times {
restart shutter_size
play shutter_inout_animation for period
col1.next = 1
col2.next = 1
}
repeat col1.palette_size times {
restart shutter_size
play shutter_outin_animation for period
col1.next = 1
col2.next = 1
}
}
run shutter_seq
}
palette rainbow_colors = [
(0, red)
(128, green)
(255, blue)
]
animation my_shutter = shutter_central(colors=rainbow_colors, period=2)
run my_shutter