122 lines
4.1 KiB
Plaintext
122 lines
4.1 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: ocean_waves.anim
|
|
# Generated automatically
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
# 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(palette=ocean_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
|
#
|
|
# # Add wave motion with moving pulses
|
|
# color wave1_pattern = rich_palette(palette=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(palette=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
|
|
|
|
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" "400040C0" "800080FF" "C040C0FF" "FF80FFFF")
|
|
# Base ocean animation with slow color cycling
|
|
var ocean_base_ = animation.rich_palette_animation(engine)
|
|
ocean_base_.palette = 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_.palette = 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
|
|
var temp_sawtooth_145 = animation.sawtooth(engine)
|
|
temp_sawtooth_145.min_value = 0
|
|
temp_sawtooth_145.max_value = 48
|
|
temp_sawtooth_145.duration = 5000
|
|
wave1_.pos = temp_sawtooth_145 # 60-12 = 48
|
|
var wave2_pattern_ = animation.rich_palette(engine)
|
|
wave2_pattern_.palette = 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
|
|
var temp_sawtooth_222 = animation.sawtooth(engine)
|
|
temp_sawtooth_222.min_value = 52
|
|
temp_sawtooth_222.max_value = 8
|
|
temp_sawtooth_222.duration = 7000
|
|
wave2_.pos = temp_sawtooth_222 # 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_animation(ocean_base_)
|
|
engine.add_animation(wave1_)
|
|
engine.add_animation(wave2_)
|
|
engine.add_animation(foam_)
|
|
engine.start()
|