112 lines
3.9 KiB
Plaintext
112 lines
3.9 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: heartbeat_pulse.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:
|
|
# # Heartbeat Pulse - Rhythmic double pulse
|
|
# # Red pulsing like a heartbeat
|
|
#
|
|
# strip length 60
|
|
#
|
|
# # Dark background
|
|
# color heart_bg = 0x110000
|
|
# animation background = solid(heart_bg)
|
|
#
|
|
# # Define heartbeat timing - double pulse pattern
|
|
# # First pulse (stronger)
|
|
# animation heartbeat1 = solid(0xFF0000) # Bright red
|
|
# heartbeat1.opacity = square(0, 255, 150ms, 20) # Quick strong pulse
|
|
# heartbeat1.priority = 10
|
|
#
|
|
# # Second pulse (weaker, slightly delayed)
|
|
# animation heartbeat2 = solid(0xCC0000) # Slightly dimmer red
|
|
# # Delay the second pulse by adjusting the square wave phase
|
|
# heartbeat2.opacity = square(0, 180, 150ms, 15) # Weaker pulse
|
|
# heartbeat2.priority = 8
|
|
#
|
|
# # Add subtle glow effect
|
|
# animation heart_glow = solid(0x660000) # Dim red glow
|
|
# heart_glow.opacity = smooth(30, 100, 1s) # Gentle breathing glow
|
|
# heart_glow.priority = 5
|
|
#
|
|
# # Add center pulse for emphasis
|
|
# animation center_pulse = pulse_position_animation(
|
|
# 0xFFFFFF, # White center
|
|
# 30, # center of strip
|
|
# 4, # small center
|
|
# 2 # soft edges
|
|
# )
|
|
# center_pulse.priority = 20
|
|
# center_pulse.opacity = square(0, 200, 100ms, 10) # Quick white flash
|
|
#
|
|
# # Start all animations
|
|
# run background
|
|
# run heart_glow
|
|
# run heartbeat1
|
|
# run heartbeat2
|
|
# run center_pulse
|
|
|
|
import animation
|
|
|
|
# Heartbeat Pulse - Rhythmic double pulse
|
|
# Red pulsing like a heartbeat
|
|
var strip = global.Leds(60)
|
|
var engine = animation.create_engine(strip)
|
|
# Dark background
|
|
var heart_bg_ = 0xFF110000
|
|
var background_ = animation.solid(animation.global('heart_bg_', 'heart_bg'))
|
|
# Define heartbeat timing - double pulse pattern
|
|
# First pulse (stronger)
|
|
var heartbeat1_ = animation.solid(0xFFFF0000) # Bright red
|
|
animation.global('heartbeat1_').opacity = animation.square(0, 255, 150, 20) # Quick strong pulse
|
|
animation.global('heartbeat1_').priority = 10
|
|
# Second pulse (weaker, slightly delayed)
|
|
var heartbeat2_ = animation.solid(0xFFCC0000) # Slightly dimmer red
|
|
# Delay the second pulse by adjusting the square wave phase
|
|
animation.global('heartbeat2_').opacity = animation.square(0, 180, 150, 15) # Weaker pulse
|
|
animation.global('heartbeat2_').priority = 8
|
|
# Add subtle glow effect
|
|
var heart_glow_ = animation.solid(0xFF660000) # Dim red glow
|
|
animation.global('heart_glow_').opacity = animation.smooth(30, 100, 1000) # Gentle breathing glow
|
|
animation.global('heart_glow_').priority = 5
|
|
# Add center pulse for emphasis
|
|
var center_pulse_ = animation.pulse_position_animation(0xFFFFFFFF, 30, 4, 2)
|
|
animation.global('center_pulse_').priority = 20
|
|
animation.global('center_pulse_').opacity = animation.square(0, 200, 100, 10) # Quick white flash
|
|
# Start all animations
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_background')
|
|
var seq_manager = global.sequence_background()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('background_'))
|
|
end
|
|
if global.contains('sequence_heart_glow')
|
|
var seq_manager = global.sequence_heart_glow()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('heart_glow_'))
|
|
end
|
|
if global.contains('sequence_heartbeat1')
|
|
var seq_manager = global.sequence_heartbeat1()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('heartbeat1_'))
|
|
end
|
|
if global.contains('sequence_heartbeat2')
|
|
var seq_manager = global.sequence_heartbeat2()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('heartbeat2_'))
|
|
end
|
|
if global.contains('sequence_center_pulse')
|
|
var seq_manager = global.sequence_center_pulse()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('center_pulse_'))
|
|
end
|
|
engine.start()
|