151 lines
6.3 KiB
Plaintext
151 lines
6.3 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: candy_cane.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:
|
|
# # Candy Cane - Red and white stripes
|
|
# # Classic Christmas candy cane pattern
|
|
#
|
|
# strip length 60
|
|
#
|
|
# # Define stripe colors
|
|
# color candy_red = 0xFF0000
|
|
# color candy_white = 0xFFFFFF
|
|
#
|
|
# # Create alternating red and white pattern
|
|
# # Using multiple pulse positions to create stripes
|
|
# animation stripe1 = pulse_position_animation(candy_red, 3, 4, 1)
|
|
# animation stripe2 = pulse_position_animation(candy_white, 9, 4, 1)
|
|
# animation stripe3 = pulse_position_animation(candy_red, 15, 4, 1)
|
|
# animation stripe4 = pulse_position_animation(candy_white, 21, 4, 1)
|
|
# animation stripe5 = pulse_position_animation(candy_red, 27, 4, 1)
|
|
# animation stripe6 = pulse_position_animation(candy_white, 33, 4, 1)
|
|
# animation stripe7 = pulse_position_animation(candy_red, 39, 4, 1)
|
|
# animation stripe8 = pulse_position_animation(candy_white, 45, 4, 1)
|
|
# animation stripe9 = pulse_position_animation(candy_red, 51, 4, 1)
|
|
# animation stripe10 = pulse_position_animation(candy_white, 57, 4, 1)
|
|
#
|
|
# # Add gentle movement to make it more dynamic
|
|
# set move_speed = 8s
|
|
# stripe1.pos = sawtooth(3, 63, move_speed)
|
|
# stripe2.pos = sawtooth(9, 69, move_speed)
|
|
# stripe3.pos = sawtooth(15, 75, move_speed)
|
|
# stripe4.pos = sawtooth(21, 81, move_speed)
|
|
# stripe5.pos = sawtooth(27, 87, move_speed)
|
|
# stripe6.pos = sawtooth(33, 93, move_speed)
|
|
# stripe7.pos = sawtooth(39, 99, move_speed)
|
|
# stripe8.pos = sawtooth(45, 105, move_speed)
|
|
# stripe9.pos = sawtooth(51, 111, move_speed)
|
|
# stripe10.pos = sawtooth(57, 117, 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
|
|
|
|
import animation
|
|
|
|
# Candy Cane - Red and white stripes
|
|
# Classic Christmas candy cane pattern
|
|
var engine = animation.init_strip(60)
|
|
# Define stripe colors
|
|
var candy_red_ = 0xFFFF0000
|
|
var candy_white_ = 0xFFFFFFFF
|
|
# Create alternating red and white pattern
|
|
# Using multiple pulse positions to create stripes
|
|
var stripe1_ = animation.pulse_position_animation(animation.global('candy_red_', 'candy_red'), 3, 4, 1)
|
|
var stripe2_ = animation.pulse_position_animation(animation.global('candy_white_', 'candy_white'), 9, 4, 1)
|
|
var stripe3_ = animation.pulse_position_animation(animation.global('candy_red_', 'candy_red'), 15, 4, 1)
|
|
var stripe4_ = animation.pulse_position_animation(animation.global('candy_white_', 'candy_white'), 21, 4, 1)
|
|
var stripe5_ = animation.pulse_position_animation(animation.global('candy_red_', 'candy_red'), 27, 4, 1)
|
|
var stripe6_ = animation.pulse_position_animation(animation.global('candy_white_', 'candy_white'), 33, 4, 1)
|
|
var stripe7_ = animation.pulse_position_animation(animation.global('candy_red_', 'candy_red'), 39, 4, 1)
|
|
var stripe8_ = animation.pulse_position_animation(animation.global('candy_white_', 'candy_white'), 45, 4, 1)
|
|
var stripe9_ = animation.pulse_position_animation(animation.global('candy_red_', 'candy_red'), 51, 4, 1)
|
|
var stripe10_ = animation.pulse_position_animation(animation.global('candy_white_', 'candy_white'), 57, 4, 1)
|
|
# Add gentle movement to make it more dynamic
|
|
var move_speed_ = 8000
|
|
animation.global('stripe1_').pos = animation.sawtooth(3, 63, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe2_').pos = animation.sawtooth(9, 69, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe3_').pos = animation.sawtooth(15, 75, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe4_').pos = animation.sawtooth(21, 81, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe5_').pos = animation.sawtooth(27, 87, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe6_').pos = animation.sawtooth(33, 93, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe7_').pos = animation.sawtooth(39, 99, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe8_').pos = animation.sawtooth(45, 105, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe9_').pos = animation.sawtooth(51, 111, animation.global('move_speed_', 'move_speed'))
|
|
animation.global('stripe10_').pos = animation.sawtooth(57, 117, animation.global('move_speed_', 'move_speed'))
|
|
# Start all stripes
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_stripe1')
|
|
var seq_manager = global.sequence_stripe1()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe1_'))
|
|
end
|
|
if global.contains('sequence_stripe2')
|
|
var seq_manager = global.sequence_stripe2()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe2_'))
|
|
end
|
|
if global.contains('sequence_stripe3')
|
|
var seq_manager = global.sequence_stripe3()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe3_'))
|
|
end
|
|
if global.contains('sequence_stripe4')
|
|
var seq_manager = global.sequence_stripe4()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe4_'))
|
|
end
|
|
if global.contains('sequence_stripe5')
|
|
var seq_manager = global.sequence_stripe5()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe5_'))
|
|
end
|
|
if global.contains('sequence_stripe6')
|
|
var seq_manager = global.sequence_stripe6()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe6_'))
|
|
end
|
|
if global.contains('sequence_stripe7')
|
|
var seq_manager = global.sequence_stripe7()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe7_'))
|
|
end
|
|
if global.contains('sequence_stripe8')
|
|
var seq_manager = global.sequence_stripe8()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe8_'))
|
|
end
|
|
if global.contains('sequence_stripe9')
|
|
var seq_manager = global.sequence_stripe9()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe9_'))
|
|
end
|
|
if global.contains('sequence_stripe10')
|
|
var seq_manager = global.sequence_stripe10()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stripe10_'))
|
|
end
|
|
engine.start()
|