110 lines
3.9 KiB
Plaintext
110 lines
3.9 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: ocean_waves.anim
|
|
# Generated automatically
|
|
#
|
|
# This file was automatically generated by compile_all_dsl_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(ocean_colors, 8s, smooth, 200)
|
|
#
|
|
# # Add wave motion with moving pulses
|
|
# pattern wave1_pattern = rich_palette_color_provider(ocean_colors, 6s, smooth, 255)
|
|
# animation wave1 = pulse_position_animation(
|
|
# wave1_pattern, # color source
|
|
# 0, # initial position
|
|
# 12, # wave width
|
|
# 6 # soft edges
|
|
# )
|
|
# wave1.priority = 10
|
|
# wave1.pos = sawtooth(0, 48, 5s) # 60-12 = 48
|
|
#
|
|
# pattern wave2_pattern = rich_palette_color_provider(ocean_colors, 4s, smooth, 180)
|
|
# animation wave2 = pulse_position_animation(
|
|
# wave2_pattern, # color source
|
|
# 52, # initial position
|
|
# 8, # smaller wave
|
|
# 4 # soft edges
|
|
# )
|
|
# wave2.priority = 8
|
|
# wave2.pos = sawtooth(52, 8, 7s) # Opposite direction
|
|
#
|
|
# # Add foam sparkles
|
|
# animation foam = twinkle_animation(
|
|
# 0xFFFFFF, # White foam
|
|
# 6, # density (sparkle count)
|
|
# 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
|
|
var strip = global.Leds(60)
|
|
var engine = animation.create_engine(strip)
|
|
# Define ocean color palette
|
|
var ocean_colors_ = bytes("00000080" "400040C0" "800080FF" "C040C0FF" "FF80FFFF")
|
|
# Base ocean animation with slow color cycling
|
|
var ocean_base_ = animation.rich_palette_animation(animation.global('ocean_colors_', 'ocean_colors'), 8000, animation.global('smooth_', 'smooth'), 200)
|
|
# Add wave motion with moving pulses
|
|
var wave1_pattern_ = animation.rich_palette_color_provider(animation.global('ocean_colors_', 'ocean_colors'), 6000, animation.global('smooth_', 'smooth'), 255)
|
|
var wave1_ = animation.pulse_position_animation(animation.global('wave1_pattern_', 'wave1_pattern'), 0, 12, 6)
|
|
animation.global('wave1_').priority = 10
|
|
animation.global('wave1_').pos = animation.sawtooth(0, 48, 5000) # 60-12 = 48
|
|
var wave2_pattern_ = animation.rich_palette_color_provider(animation.global('ocean_colors_', 'ocean_colors'), 4000, animation.global('smooth_', 'smooth'), 180)
|
|
var wave2_ = animation.pulse_position_animation(animation.global('wave2_pattern_', 'wave2_pattern'), 52, 8, 4)
|
|
animation.global('wave2_').priority = 8
|
|
animation.global('wave2_').pos = animation.sawtooth(52, 8, 7000) # Opposite direction
|
|
# Add foam sparkles
|
|
var foam_ = animation.twinkle_animation(0xFFFFFFFF, 6, 300)
|
|
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()
|