mirror of
https://github.com/arendst/Tasmota.git
synced 2025-11-24 18:27:46 +00:00
169 lines
5.7 KiB
Plaintext
169 lines
5.7 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: lava_lamp.anim
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
import animation
|
|
|
|
# Lava Lamp - Slow flowing warm colors
|
|
# Organic movement like a lava lamp
|
|
#strip length 60
|
|
# Define lava colors (warm oranges and reds)
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var lava_colors_ = bytes(
|
|
"00330000" # Dark red
|
|
"40660000" # Medium red
|
|
"80CC3300" # Bright red
|
|
"C0FF6600" # Orange
|
|
"FFFFAA00" # Yellow-orange
|
|
)
|
|
# Base lava animation - very slow color changes
|
|
var lava_base_ = animation.rich_palette_animation(engine)
|
|
lava_base_.palette = lava_colors_
|
|
lava_base_.cycle_period = 15000
|
|
lava_base_.transition_type = animation.SINE
|
|
lava_base_.brightness = 180
|
|
# Add slow-moving lava blobs
|
|
var blob1_pattern_ = animation.rich_palette(engine)
|
|
blob1_pattern_.palette = lava_colors_
|
|
blob1_pattern_.cycle_period = 12000
|
|
blob1_pattern_.transition_type = animation.SINE
|
|
blob1_pattern_.brightness = 255
|
|
var lava_blob1_ = animation.beacon_animation(engine)
|
|
lava_blob1_.color = blob1_pattern_ # color source
|
|
lava_blob1_.pos = 9 # initial position
|
|
lava_blob1_.beacon_size = 18 # large blob
|
|
lava_blob1_.slew_size = 12 # very soft edges
|
|
lava_blob1_.priority = 10
|
|
lava_blob1_.pos = (def (engine)
|
|
var provider = animation.smooth(engine)
|
|
provider.min_value = 9
|
|
provider.max_value = 51
|
|
provider.duration = 20000
|
|
return provider
|
|
end)(engine) # Very slow movement
|
|
var blob2_pattern_ = animation.rich_palette(engine)
|
|
blob2_pattern_.palette = lava_colors_
|
|
blob2_pattern_.cycle_period = 10000
|
|
blob2_pattern_.transition_type = animation.SINE
|
|
blob2_pattern_.brightness = 220
|
|
var lava_blob2_ = animation.beacon_animation(engine)
|
|
lava_blob2_.color = blob2_pattern_ # color source
|
|
lava_blob2_.pos = 46 # initial position
|
|
lava_blob2_.beacon_size = 14 # medium blob
|
|
lava_blob2_.slew_size = 10 # soft edges
|
|
lava_blob2_.priority = 8
|
|
lava_blob2_.pos = (def (engine)
|
|
var provider = animation.smooth(engine)
|
|
provider.min_value = 46
|
|
provider.max_value = 14
|
|
provider.duration = 25000
|
|
return provider
|
|
end)(engine) # Opposite direction, slower
|
|
var blob3_pattern_ = animation.rich_palette(engine)
|
|
blob3_pattern_.palette = lava_colors_
|
|
blob3_pattern_.cycle_period = 8000
|
|
blob3_pattern_.transition_type = animation.SINE
|
|
blob3_pattern_.brightness = 200
|
|
var lava_blob3_ = animation.beacon_animation(engine)
|
|
lava_blob3_.color = blob3_pattern_ # color source
|
|
lava_blob3_.pos = 25 # initial position
|
|
lava_blob3_.beacon_size = 10 # smaller blob
|
|
lava_blob3_.slew_size = 8 # soft edges
|
|
lava_blob3_.priority = 6
|
|
lava_blob3_.pos = (def (engine)
|
|
var provider = animation.smooth(engine)
|
|
provider.min_value = 25
|
|
provider.max_value = 35
|
|
provider.duration = 18000
|
|
return provider
|
|
end)(engine) # Small movement range
|
|
# Add subtle heat shimmer effect
|
|
var shimmer_pattern_ = animation.rich_palette(engine)
|
|
shimmer_pattern_.palette = lava_colors_
|
|
shimmer_pattern_.cycle_period = 6000
|
|
shimmer_pattern_.transition_type = animation.SINE
|
|
shimmer_pattern_.brightness = 255
|
|
var heat_shimmer_ = animation.twinkle_animation(engine)
|
|
heat_shimmer_.color = shimmer_pattern_ # color source
|
|
heat_shimmer_.density = 6 # density (shimmer points)
|
|
heat_shimmer_.twinkle_speed = 1500 # twinkle speed (slow shimmer)
|
|
heat_shimmer_.priority = 15
|
|
# Start all animations
|
|
engine.add(lava_base_)
|
|
engine.add(lava_blob1_)
|
|
engine.add(lava_blob2_)
|
|
engine.add(lava_blob3_)
|
|
engine.add(heat_shimmer_)
|
|
engine.run()
|
|
|
|
|
|
#- Original DSL source:
|
|
# Lava Lamp - Slow flowing warm colors
|
|
# Organic movement like a lava lamp
|
|
|
|
#strip length 60
|
|
|
|
# Define lava colors (warm oranges and reds)
|
|
palette lava_colors = [
|
|
(0, 0x330000), # Dark red
|
|
(64, 0x660000), # Medium red
|
|
(128, 0xCC3300), # Bright red
|
|
(192, 0xFF6600), # Orange
|
|
(255, 0xFFAA00) # Yellow-orange
|
|
]
|
|
|
|
# Base lava animation - very slow color changes
|
|
animation lava_base = rich_palette_animation(palette=lava_colors, cycle_period=15s, transition_type=SINE, brightness=180)
|
|
|
|
# Add slow-moving lava blobs
|
|
color blob1_pattern = rich_palette(palette=lava_colors, cycle_period=12s, transition_type=SINE, brightness=255)
|
|
animation lava_blob1 = beacon_animation(
|
|
color=blob1_pattern # color source
|
|
pos=9 # initial position
|
|
beacon_size=18 # large blob
|
|
slew_size=12 # very soft edges
|
|
)
|
|
lava_blob1.priority = 10
|
|
lava_blob1.pos = smooth(min_value=9, max_value=51, duration=20s) # Very slow movement
|
|
|
|
color blob2_pattern = rich_palette(palette=lava_colors, cycle_period=10s, transition_type=SINE, brightness=220)
|
|
animation lava_blob2 = beacon_animation(
|
|
color=blob2_pattern # color source
|
|
pos=46 # initial position
|
|
beacon_size=14 # medium blob
|
|
slew_size=10 # soft edges
|
|
)
|
|
lava_blob2.priority = 8
|
|
lava_blob2.pos = smooth(min_value=46, max_value=14, duration=25s) # Opposite direction, slower
|
|
|
|
color blob3_pattern = rich_palette(palette=lava_colors, cycle_period=8s, transition_type=SINE, brightness=200)
|
|
animation lava_blob3 = beacon_animation(
|
|
color=blob3_pattern # color source
|
|
pos=25 # initial position
|
|
beacon_size=10 # smaller blob
|
|
slew_size=8 # soft edges
|
|
)
|
|
lava_blob3.priority = 6
|
|
lava_blob3.pos = smooth(min_value=25, max_value=35, duration=18s) # Small movement range
|
|
|
|
# Add subtle heat shimmer effect
|
|
color shimmer_pattern = rich_palette(palette=lava_colors, cycle_period=6s, transition_type=SINE, brightness=255)
|
|
animation heat_shimmer = twinkle_animation(
|
|
color=shimmer_pattern # color source
|
|
density=6 # density (shimmer points)
|
|
twinkle_speed=1.5s # twinkle speed (slow shimmer)
|
|
)
|
|
heat_shimmer.priority = 15
|
|
|
|
# Start all animations
|
|
run lava_base
|
|
run lava_blob1
|
|
run lava_blob2
|
|
run lava_blob3
|
|
run heat_shimmer
|
|
-#
|