mirror of
https://github.com/arendst/Tasmota.git
synced 2025-12-04 15:17:47 +00:00
204 lines
6.2 KiB
Plaintext
204 lines
6.2 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: candy_cane.anim
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
import animation
|
|
|
|
# Candy Cane - Red and white stripes
|
|
# Classic Christmas candy cane animation
|
|
#strip length 60
|
|
# Define stripe colors
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var candy_red_ = 0xFFFF0000
|
|
var candy_white_ = 0xFFFFFFFF
|
|
# Create alternating red and white animation
|
|
# Using multiple pulse positions to create stripes
|
|
var stripe1_ = animation.beacon_animation(engine)
|
|
stripe1_.color = candy_red_
|
|
stripe1_.pos = 3
|
|
stripe1_.beacon_size = 4
|
|
stripe1_.slew_size = 1
|
|
var stripe2_ = animation.beacon_animation(engine)
|
|
stripe2_.color = candy_white_
|
|
stripe2_.pos = 9
|
|
stripe2_.beacon_size = 4
|
|
stripe2_.slew_size = 1
|
|
var stripe3_ = animation.beacon_animation(engine)
|
|
stripe3_.color = candy_red_
|
|
stripe3_.pos = 15
|
|
stripe3_.beacon_size = 4
|
|
stripe3_.slew_size = 1
|
|
var stripe4_ = animation.beacon_animation(engine)
|
|
stripe4_.color = candy_white_
|
|
stripe4_.pos = 21
|
|
stripe4_.beacon_size = 4
|
|
stripe4_.slew_size = 1
|
|
var stripe5_ = animation.beacon_animation(engine)
|
|
stripe5_.color = candy_red_
|
|
stripe5_.pos = 27
|
|
stripe5_.beacon_size = 4
|
|
stripe5_.slew_size = 1
|
|
var stripe6_ = animation.beacon_animation(engine)
|
|
stripe6_.color = candy_white_
|
|
stripe6_.pos = 33
|
|
stripe6_.beacon_size = 4
|
|
stripe6_.slew_size = 1
|
|
var stripe7_ = animation.beacon_animation(engine)
|
|
stripe7_.color = candy_red_
|
|
stripe7_.pos = 39
|
|
stripe7_.beacon_size = 4
|
|
stripe7_.slew_size = 1
|
|
var stripe8_ = animation.beacon_animation(engine)
|
|
stripe8_.color = candy_white_
|
|
stripe8_.pos = 45
|
|
stripe8_.beacon_size = 4
|
|
stripe8_.slew_size = 1
|
|
var stripe9_ = animation.beacon_animation(engine)
|
|
stripe9_.color = candy_red_
|
|
stripe9_.pos = 51
|
|
stripe9_.beacon_size = 4
|
|
stripe9_.slew_size = 1
|
|
var stripe10_ = animation.beacon_animation(engine)
|
|
stripe10_.color = candy_white_
|
|
stripe10_.pos = 57
|
|
stripe10_.beacon_size = 4
|
|
stripe10_.slew_size = 1
|
|
# Add gentle movement to make it more dynamic
|
|
var move_speed_ = 8000
|
|
stripe1_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 3
|
|
provider.max_value = 63
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe2_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 9
|
|
provider.max_value = 69
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe3_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 15
|
|
provider.max_value = 75
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe4_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 21
|
|
provider.max_value = 81
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe5_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 27
|
|
provider.max_value = 87
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe6_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 33
|
|
provider.max_value = 93
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe7_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 39
|
|
provider.max_value = 99
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe8_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 45
|
|
provider.max_value = 105
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe9_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 51
|
|
provider.max_value = 111
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
stripe10_.pos = (def (engine)
|
|
var provider = animation.sawtooth(engine)
|
|
provider.min_value = 57
|
|
provider.max_value = 117
|
|
provider.duration = move_speed_
|
|
return provider
|
|
end)(engine)
|
|
# Start all stripes
|
|
engine.add(stripe1_)
|
|
engine.add(stripe2_)
|
|
engine.add(stripe3_)
|
|
engine.add(stripe4_)
|
|
engine.add(stripe5_)
|
|
engine.add(stripe6_)
|
|
engine.add(stripe7_)
|
|
engine.add(stripe8_)
|
|
engine.add(stripe9_)
|
|
engine.add(stripe10_)
|
|
engine.run()
|
|
|
|
|
|
#- Original DSL source:
|
|
# Candy Cane - Red and white stripes
|
|
# Classic Christmas candy cane animation
|
|
|
|
#strip length 60
|
|
|
|
# Define stripe colors
|
|
color candy_red = 0xFF0000
|
|
color candy_white = 0xFFFFFF
|
|
|
|
# Create alternating red and white animation
|
|
# Using multiple pulse positions to create stripes
|
|
animation stripe1 = beacon_animation(color=candy_red, pos=3, beacon_size=4, slew_size=1)
|
|
animation stripe2 = beacon_animation(color=candy_white, pos=9, beacon_size=4, slew_size=1)
|
|
animation stripe3 = beacon_animation(color=candy_red, pos=15, beacon_size=4, slew_size=1)
|
|
animation stripe4 = beacon_animation(color=candy_white, pos=21, beacon_size=4, slew_size=1)
|
|
animation stripe5 = beacon_animation(color=candy_red, pos=27, beacon_size=4, slew_size=1)
|
|
animation stripe6 = beacon_animation(color=candy_white, pos=33, beacon_size=4, slew_size=1)
|
|
animation stripe7 = beacon_animation(color=candy_red, pos=39, beacon_size=4, slew_size=1)
|
|
animation stripe8 = beacon_animation(color=candy_white, pos=45, beacon_size=4, slew_size=1)
|
|
animation stripe9 = beacon_animation(color=candy_red, pos=51, beacon_size=4, slew_size=1)
|
|
animation stripe10 = beacon_animation(color=candy_white, pos=57, beacon_size=4, slew_size=1)
|
|
|
|
# Add gentle movement to make it more dynamic
|
|
set move_speed = 8s
|
|
stripe1.pos = sawtooth(min_value=3, max_value=63, duration=move_speed)
|
|
stripe2.pos = sawtooth(min_value=9, max_value=69, duration=move_speed)
|
|
stripe3.pos = sawtooth(min_value=15, max_value=75, duration=move_speed)
|
|
stripe4.pos = sawtooth(min_value=21, max_value=81, duration=move_speed)
|
|
stripe5.pos = sawtooth(min_value=27, max_value=87, duration=move_speed)
|
|
stripe6.pos = sawtooth(min_value=33, max_value=93, duration=move_speed)
|
|
stripe7.pos = sawtooth(min_value=39, max_value=99, duration=move_speed)
|
|
stripe8.pos = sawtooth(min_value=45, max_value=105, duration=move_speed)
|
|
stripe9.pos = sawtooth(min_value=51, max_value=111, duration=move_speed)
|
|
stripe10.pos = sawtooth(min_value=57, max_value=117, duration=move_speed)
|
|
|
|
# Start all stripes
|
|
run stripe1
|
|
run stripe2
|
|
run stripe3
|
|
run stripe4
|
|
run stripe5
|
|
run stripe6
|
|
run stripe7
|
|
run stripe8
|
|
run stripe9
|
|
run stripe10
|
|
-#
|