Files
2025-09-28 23:38:57 +02:00

65 lines
1.9 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: cylon_generic.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
import animation
# Cylon Red Eye
# Automatically adapts to the length of the strip
# Template function: cylon_effect
def cylon_effect_template(engine, eye_color_, back_color_, duration_)
var strip_len_ = animation.strip_length(engine)
var eye_animation_ = animation.beacon_animation(engine)
eye_animation_.color = eye_color_
eye_animation_.back_color = back_color_
eye_animation_.pos = (def (engine)
var provider = animation.cosine_osc(engine)
provider.min_value = (-1)
provider.max_value = animation.create_closure_value(engine, def (engine) return animation.resolve(strip_len_) - 2 end)
provider.duration = duration_
return provider
end)(engine)
eye_animation_.beacon_size = 3 # small 3 pixels eye
eye_animation_.slew_size = 2 # with 2 pixel shading around
eye_animation_.priority = 5
engine.add(eye_animation_)
end
animation.register_user_function('cylon_effect', cylon_effect_template)
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
cylon_effect_template(engine, 0xFFFF0000, 0x00000000, 3000)
engine.run()
#- Original DSL source:
# Cylon Red Eye
# Automatically adapts to the length of the strip
template cylon_effect {
param eye_color type color
param back_color type color
param duration
set strip_len = strip_length()
animation eye_animation = beacon_animation(
color = eye_color
back_color = back_color
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = duration)
beacon_size = 3 # small 3 pixels eye
slew_size = 2 # with 2 pixel shading around
priority = 5
)
run eye_animation
}
cylon_effect(red, transparent, 3s)
-#