Tasmota/lib/libesp32/berry_animation/anim_examples/compiled/ocean_waves.be

133 lines
4.0 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: ocean_waves.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
import animation
# Ocean Waves - Blue-green wave simulation
# Flowing water colors with wave motion
#strip length 60
# Define ocean color palette
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var ocean_colors_ = bytes(
"00000080" # Deep blue
"400040C0" # Ocean blue
"800080FF" # Light blue
"C040C0FF" # Cyan
"FF80FFFF" # Light cyan
)
# Base ocean animation with slow color cycling
var ocean_base_ = animation.rich_palette_animation(engine)
ocean_base_.colors = ocean_colors_
ocean_base_.cycle_period = 8000
ocean_base_.transition_type = animation.SINE
ocean_base_.brightness = 200
# Add wave motion with moving pulses
var wave1_pattern_ = animation.rich_palette(engine)
wave1_pattern_.colors = ocean_colors_
wave1_pattern_.cycle_period = 6000
wave1_pattern_.transition_type = animation.SINE
wave1_pattern_.brightness = 255
var wave1_ = animation.beacon_animation(engine)
wave1_.color = wave1_pattern_ # color source
wave1_.pos = 0 # initial position
wave1_.beacon_size = 12 # wave width
wave1_.slew_size = 6 # soft edges
wave1_.priority = 10
wave1_.pos = (def (engine)
var provider = animation.sawtooth(engine)
provider.min_value = 0
provider.max_value = 48
provider.duration = 5000
return provider
end)(engine) # 60-12 = 48
var wave2_pattern_ = animation.rich_palette(engine)
wave2_pattern_.colors = ocean_colors_
wave2_pattern_.cycle_period = 4000
wave2_pattern_.transition_type = animation.SINE
wave2_pattern_.brightness = 180
var wave2_ = animation.beacon_animation(engine)
wave2_.color = wave2_pattern_ # color source
wave2_.pos = 52 # initial position
wave2_.beacon_size = 8 # smaller wave
wave2_.slew_size = 4 # soft edges
wave2_.priority = 8
wave2_.pos = (def (engine)
var provider = animation.sawtooth(engine)
provider.min_value = 52
provider.max_value = 8
provider.duration = 7000
return provider
end)(engine) # Opposite direction
# Add foam sparkles
var foam_ = animation.twinkle_animation(engine)
foam_.color = 0xFFFFFFFF # White foam
foam_.density = 6 # density (sparkle count)
foam_.twinkle_speed = 300 # twinkle speed (quick sparkles)
foam_.priority = 15
# Start all animations
engine.add(ocean_base_)
engine.add(wave1_)
engine.add(wave2_)
engine.add(foam_)
engine.run()
#- Original DSL source:
# Ocean Waves - Blue-green wave simulation
# Flowing water colors with wave motion
#strip length 60
# Define ocean color palette
palette ocean_colors = [
(0, 0x000080), # Deep blue
(64, 0x0040C0), # Ocean blue
(128, 0x0080FF), # Light blue
(192, 0x40C0FF), # Cyan
(255, 0x80FFFF) # Light cyan
]
# Base ocean animation with slow color cycling
animation ocean_base = rich_palette_animation(colors=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
# Add wave motion with moving pulses
color wave1_pattern = rich_palette(colors=ocean_colors, cycle_period=6s, transition_type=SINE, brightness=255)
animation wave1 = beacon_animation(
color=wave1_pattern # color source
pos=0 # initial position
beacon_size=12 # wave width
slew_size=6 # soft edges
)
wave1.priority = 10
wave1.pos = sawtooth(min_value=0, max_value=48, duration=5s) # 60-12 = 48
color wave2_pattern = rich_palette(colors=ocean_colors, cycle_period=4s, transition_type=SINE, brightness=180)
animation wave2 = beacon_animation(
color=wave2_pattern # color source
pos=52 # initial position
beacon_size=8 # smaller wave
slew_size=4 # soft edges
)
wave2.priority = 8
wave2.pos = sawtooth(min_value=52, max_value=8, duration=7s) # Opposite direction
# Add foam sparkles
animation foam = twinkle_animation(
color=0xFFFFFF # White foam
density=6 # density (sparkle count)
twinkle_speed=300ms # twinkle speed (quick sparkles)
)
foam.priority = 15
# Start all animations
run ocean_base
run wave1
run wave2
run foam
-#