Files
2025-09-03 22:10:31 +02:00

140 lines
4.4 KiB
Plaintext

# Generated Berry code from Animation DSL
# Source: christmas_tree.anim
#
# This file was automatically generated by compile_all_examples.sh
# Do not edit manually - changes will be overwritten
import animation
# Christmas Tree - Festive holiday colors
# Green base with colorful ornaments and twinkling
#strip length 60
# Green tree base
# Auto-generated strip initialization (using Tasmota configuration)
var engine = animation.init_strip()
var tree_green_ = 0xFF006600
var tree_base_ = animation.solid(engine)
tree_base_.color = tree_green_
# Define ornament colors
var ornament_colors_ = bytes(
"00FF0000" # Red
"40FFD700" # Gold
"800000FF" # Blue
"C0FFFFFF" # White
"FFFF00FF" # Magenta
)
# Colorful ornaments as twinkling lights
var ornament_pattern_ = animation.rich_palette(engine)
ornament_pattern_.palette = ornament_colors_
ornament_pattern_.cycle_period = 3000
ornament_pattern_.transition_type = animation.LINEAR
ornament_pattern_.brightness = 255
var ornaments_ = animation.twinkle_animation(engine)
ornaments_.color = ornament_pattern_ # color source
ornaments_.density = 15 # density (many ornaments)
ornaments_.twinkle_speed = 800 # twinkle speed (slow twinkle)
ornaments_.priority = 10
# Star on top (bright yellow pulse)
var tree_star_ = animation.beacon_animation(engine)
tree_star_.color = 0xFFFFFF00 # Bright yellow
tree_star_.pos = 58 # position (near the top)
tree_star_.beacon_size = 3 # star size
tree_star_.slew_size = 1 # sharp edges
tree_star_.priority = 20
tree_star_.opacity = (def (engine)
var provider = animation.smooth(engine)
provider.min_value = 200
provider.max_value = 255
provider.duration = 2000
return provider
end)(engine) # Gentle pulsing
# Add some white sparkles for snow/magic
var snow_sparkles_ = animation.twinkle_animation(engine)
snow_sparkles_.color = 0xFFFFFFFF # White snow
snow_sparkles_.density = 8 # density (sparkle count)
snow_sparkles_.twinkle_speed = 400 # twinkle speed (quick sparkles)
snow_sparkles_.priority = 15
# Garland effect - moving colored lights
var garland_pattern_ = animation.rich_palette(engine)
garland_pattern_.palette = ornament_colors_
garland_pattern_.cycle_period = 2000
garland_pattern_.transition_type = animation.LINEAR
garland_pattern_.brightness = 200
var garland_ = animation.comet_animation(engine)
garland_.color = garland_pattern_ # color source
garland_.tail_length = 6 # garland length (tail length)
garland_.speed = 4000 # slow movement (speed)
garland_.priority = 5
# Start all animations
engine.add(tree_base_)
engine.add(ornaments_)
engine.add(tree_star_)
engine.add(snow_sparkles_)
engine.add(garland_)
engine.run()
#- Original DSL source:
# Christmas Tree - Festive holiday colors
# Green base with colorful ornaments and twinkling
#strip length 60
# Green tree base
color tree_green = 0x006600
animation tree_base = solid(color=tree_green)
# Define ornament colors
palette ornament_colors = [
(0, 0xFF0000), # Red
(64, 0xFFD700), # Gold
(128, 0x0000FF), # Blue
(192, 0xFFFFFF), # White
(255, 0xFF00FF) # Magenta
]
# Colorful ornaments as twinkling lights
color ornament_pattern = rich_palette(palette=ornament_colors, cycle_period=3s, transition_type=LINEAR, brightness=255)
animation ornaments = twinkle_animation(
color=ornament_pattern # color source
density=15 # density (many ornaments)
twinkle_speed=800ms # twinkle speed (slow twinkle)
)
ornaments.priority = 10
# Star on top (bright yellow pulse)
animation tree_star = beacon_animation(
color=0xFFFF00 # Bright yellow
pos=58 # position (near the top)
beacon_size=3 # star size
slew_size=1 # sharp edges
)
tree_star.priority = 20
tree_star.opacity = smooth(min_value=200, max_value=255, duration=2s) # Gentle pulsing
# Add some white sparkles for snow/magic
animation snow_sparkles = twinkle_animation(
color=0xFFFFFF # White snow
density=8 # density (sparkle count)
twinkle_speed=400ms # twinkle speed (quick sparkles)
)
snow_sparkles.priority = 15
# Garland effect - moving colored lights
color garland_pattern = rich_palette(palette=ornament_colors, cycle_period=2s, transition_type=LINEAR, brightness=200)
animation garland = comet_animation(
color=garland_pattern # color source
tail_length=6 # garland length (tail length)
speed=4s # slow movement (speed)
)
garland.priority = 5
# Start all animations
run tree_base
run ornaments
run tree_star
run snow_sparkles
run garland
-#