143 lines
5.0 KiB
Plaintext
143 lines
5.0 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 = animation.global('ocean_colors_', 'ocean_colors')
|
|
ocean_base_.cycle_period = 8000
|
|
ocean_base_.transition_type = animation.global('SINE_', 'SINE')
|
|
ocean_base_.brightness = 200
|
|
# Add wave motion with moving pulses
|
|
var wave1_pattern_ = animation.rich_palette(engine)
|
|
wave1_pattern_.palette = animation.global('ocean_colors_', 'ocean_colors')
|
|
wave1_pattern_.cycle_period = 6000
|
|
wave1_pattern_.transition_type = animation.global('SINE_', 'SINE')
|
|
wave1_pattern_.brightness = 255
|
|
var wave1_ = animation.beacon_animation(engine)
|
|
wave1_.color = animation.global('wave1_pattern_', 'wave1_pattern')
|
|
wave1_.pos = 0
|
|
wave1_.beacon_size = 12
|
|
wave1_.slew_size = 6 # soft edges
|
|
animation.global('wave1_').priority = 10
|
|
var temp_sawtooth_148 = animation.sawtooth(engine)
|
|
temp_sawtooth_148.min_value = 0
|
|
temp_sawtooth_148.max_value = 48
|
|
temp_sawtooth_148.duration = 5000
|
|
animation.global('wave1_').pos = temp_sawtooth_148 # 60-12 = 48
|
|
var wave2_pattern_ = animation.rich_palette(engine)
|
|
wave2_pattern_.palette = animation.global('ocean_colors_', 'ocean_colors')
|
|
wave2_pattern_.cycle_period = 4000
|
|
wave2_pattern_.transition_type = animation.global('SINE_', 'SINE')
|
|
wave2_pattern_.brightness = 180
|
|
var wave2_ = animation.beacon_animation(engine)
|
|
wave2_.color = animation.global('wave2_pattern_', 'wave2_pattern')
|
|
wave2_.pos = 52
|
|
wave2_.beacon_size = 8
|
|
wave2_.slew_size = 4 # soft edges
|
|
animation.global('wave2_').priority = 8
|
|
var temp_sawtooth_228 = animation.sawtooth(engine)
|
|
temp_sawtooth_228.min_value = 52
|
|
temp_sawtooth_228.max_value = 8
|
|
temp_sawtooth_228.duration = 7000
|
|
animation.global('wave2_').pos = temp_sawtooth_228 # Opposite direction
|
|
# Add foam sparkles
|
|
var foam_ = animation.twinkle_animation(engine)
|
|
foam_.color = 0xFFFFFFFF
|
|
foam_.density = 6
|
|
foam_.twinkle_speed = 300 # twinkle speed (quick sparkles)
|
|
animation.global('foam_').priority = 15
|
|
# Start all animations
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_ocean_base')
|
|
var seq_manager = global.sequence_ocean_base()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('ocean_base_'))
|
|
end
|
|
if global.contains('sequence_wave1')
|
|
var seq_manager = global.sequence_wave1()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('wave1_'))
|
|
end
|
|
if global.contains('sequence_wave2')
|
|
var seq_manager = global.sequence_wave2()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('wave2_'))
|
|
end
|
|
if global.contains('sequence_foam')
|
|
var seq_manager = global.sequence_foam()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('foam_'))
|
|
end
|
|
engine.start()
|