Files
2025-09-03 22:10:31 +02:00

127 lines
3.8 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: heartbeat_pulse.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
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 = heart_bg_
# Define heartbeat timing - double pulse animation
# First pulse (stronger)
var heartbeat1_ = animation.solid(engine)
heartbeat1_.color = 0xFFFF0000
# Bright red
heartbeat1_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 255
provider.duration = 150
provider.duty_cycle = 20
return provider
end)(engine) # Quick strong pulse
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
heartbeat2_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 180
provider.duration = 150
provider.duty_cycle = 15
return provider
end)(engine) # Weaker pulse
heartbeat2_.priority = 8
# Add subtle glow effect
var heart_glow_ = animation.solid(engine)
heart_glow_.color = 0xFF660000
# Dim red glow
heart_glow_.opacity = (def (engine)
var provider = animation.smooth(engine)
provider.min_value = 30
provider.max_value = 100
provider.duration = 1000
return provider
end)(engine) # Gentle breathing glow
heart_glow_.priority = 5
# Add center pulse for emphasis
var center_pulse_ = animation.beacon_animation(engine)
center_pulse_.color = 0xFFFFFFFF # White center
center_pulse_.pos = 30 # center of strip
center_pulse_.beacon_size = 4 # small center
center_pulse_.slew_size = 2 # soft edges
center_pulse_.priority = 20
center_pulse_.opacity = (def (engine)
var provider = animation.square(engine)
provider.min_value = 0
provider.max_value = 200
provider.duration = 100
provider.duty_cycle = 10
return provider
end)(engine) # Quick white flash
# Start all animations
engine.add(background_)
engine.add(heart_glow_)
engine.add(heartbeat1_)
engine.add(heartbeat2_)
engine.add(center_pulse_)
engine.run()
#- 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
-#