144 lines
4.9 KiB
Plaintext
144 lines
4.9 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: heartbeat_pulse.anim
|
|
# Generated automatically
|
|
#
|
|
# This file was automatically generated by compile_all_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(color=heart_bg)
|
|
#
|
|
# # Define heartbeat timing - double pulse animation
|
|
# # First pulse (stronger)
|
|
# animation heartbeat1 = solid(color=0xFF0000) # Bright red
|
|
# heartbeat1.opacity = square(min_value=0, max_value=255, duration=150ms, duty_cycle=20) # Quick strong pulse
|
|
# heartbeat1.priority = 10
|
|
#
|
|
# # Second pulse (weaker, slightly delayed)
|
|
# animation heartbeat2 = solid(color=0xCC0000) # Slightly dimmer red
|
|
# # Delay the second pulse by adjusting the square wave phase
|
|
# heartbeat2.opacity = square(min_value=0, max_value=180, duration=150ms, duty_cycle=15) # Weaker pulse
|
|
# heartbeat2.priority = 8
|
|
#
|
|
# # Add subtle glow effect
|
|
# animation heart_glow = solid(color=0x660000) # Dim red glow
|
|
# heart_glow.opacity = smooth(min_value=30, max_value=100, duration=1s) # Gentle breathing glow
|
|
# heart_glow.priority = 5
|
|
#
|
|
# # Add center pulse for emphasis
|
|
# animation center_pulse = beacon_animation(
|
|
# color=0xFFFFFF, # White center
|
|
# pos=30, # center of strip
|
|
# beacon_size=4, # small center
|
|
# slew_size=2 # soft edges
|
|
# )
|
|
# center_pulse.priority = 20
|
|
# center_pulse.opacity = square(min_value=0, max_value=200, duration=100ms, duty_cycle=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
|
|
#strip length 60
|
|
# Dark background
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var heart_bg_ = 0xFF110000
|
|
var background_ = animation.solid(engine)
|
|
background_.color = animation.global('heart_bg_', 'heart_bg')
|
|
# Define heartbeat timing - double pulse animation
|
|
# First pulse (stronger)
|
|
var heartbeat1_ = animation.solid(engine)
|
|
heartbeat1_.color = 0xFFFF0000
|
|
# Bright red
|
|
var temp_square_46 = animation.square(engine)
|
|
temp_square_46.min_value = 0
|
|
temp_square_46.max_value = 255
|
|
temp_square_46.duration = 150
|
|
temp_square_46.duty_cycle = 20
|
|
animation.global('heartbeat1_').opacity = temp_square_46 # Quick strong pulse
|
|
animation.global('heartbeat1_').priority = 10
|
|
# Second pulse (weaker, slightly delayed)
|
|
var heartbeat2_ = animation.solid(engine)
|
|
heartbeat2_.color = 0xFFCC0000
|
|
# Slightly dimmer red
|
|
# Delay the second pulse by adjusting the square wave phase
|
|
var temp_square_92 = animation.square(engine)
|
|
temp_square_92.min_value = 0
|
|
temp_square_92.max_value = 180
|
|
temp_square_92.duration = 150
|
|
temp_square_92.duty_cycle = 15
|
|
animation.global('heartbeat2_').opacity = temp_square_92 # Weaker pulse
|
|
animation.global('heartbeat2_').priority = 8
|
|
# Add subtle glow effect
|
|
var heart_glow_ = animation.solid(engine)
|
|
heart_glow_.color = 0xFF660000
|
|
# Dim red glow
|
|
var temp_smooth_136 = animation.smooth(engine)
|
|
temp_smooth_136.min_value = 30
|
|
temp_smooth_136.max_value = 100
|
|
temp_smooth_136.duration = 1000
|
|
animation.global('heart_glow_').opacity = temp_smooth_136 # Gentle breathing glow
|
|
animation.global('heart_glow_').priority = 5
|
|
# Add center pulse for emphasis
|
|
var center_pulse_ = animation.beacon_animation(engine)
|
|
center_pulse_.color = 0xFFFFFFFF
|
|
center_pulse_.pos = 30
|
|
center_pulse_.beacon_size = 4
|
|
center_pulse_.slew_size = 2 # soft edges
|
|
animation.global('center_pulse_').priority = 20
|
|
var temp_square_202 = animation.square(engine)
|
|
temp_square_202.min_value = 0
|
|
temp_square_202.max_value = 200
|
|
temp_square_202.duration = 100
|
|
temp_square_202.duty_cycle = 10
|
|
animation.global('center_pulse_').opacity = temp_square_202 # 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()
|