134 lines
4.1 KiB
Plaintext
134 lines
4.1 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: matrix_rain.anim
|
|
#
|
|
# This file was automatically generated by compile_all_examples.sh
|
|
# Do not edit manually - changes will be overwritten
|
|
|
|
import animation
|
|
|
|
# Matrix Rain - Digital rain effect
|
|
# Green cascading code like The Matrix
|
|
#strip length 60
|
|
# Dark background
|
|
# Auto-generated strip initialization (using Tasmota configuration)
|
|
var engine = animation.init_strip()
|
|
|
|
var matrix_bg_ = 0xFF000000
|
|
var background_ = animation.solid(engine)
|
|
background_.color = matrix_bg_
|
|
background_.priority = 50
|
|
# Define matrix green palette
|
|
var matrix_greens_ = bytes(
|
|
"00000000" # Black
|
|
"40003300" # Dark green
|
|
"80006600" # Medium green
|
|
"C000AA00" # Bright green
|
|
"FF00FF00" # Neon green
|
|
)
|
|
# Create multiple cascading streams
|
|
var stream1_pattern_ = animation.rich_palette(engine)
|
|
stream1_pattern_.colors = matrix_greens_
|
|
stream1_pattern_.cycle_period = 2000
|
|
stream1_pattern_.transition_type = animation.LINEAR
|
|
stream1_pattern_.brightness = 255
|
|
var stream1_ = animation.comet_animation(engine)
|
|
stream1_.color = stream1_pattern_ # color source
|
|
stream1_.tail_length = 15 # long tail
|
|
stream1_.speed = 1500 # speed
|
|
stream1_.priority = 10
|
|
var stream2_pattern_ = animation.rich_palette(engine)
|
|
stream2_pattern_.colors = matrix_greens_
|
|
stream2_pattern_.cycle_period = 1800
|
|
stream2_pattern_.transition_type = animation.LINEAR
|
|
stream2_pattern_.brightness = 200
|
|
var stream2_ = animation.comet_animation(engine)
|
|
stream2_.color = stream2_pattern_ # color source
|
|
stream2_.tail_length = 12 # medium tail
|
|
stream2_.speed = 2200 # different speed
|
|
stream2_.priority = 8
|
|
var stream3_pattern_ = animation.rich_palette(engine)
|
|
stream3_pattern_.colors = matrix_greens_
|
|
stream3_pattern_.cycle_period = 2500
|
|
stream3_pattern_.transition_type = animation.LINEAR
|
|
stream3_pattern_.brightness = 180
|
|
var stream3_ = animation.comet_animation(engine)
|
|
stream3_.color = stream3_pattern_ # color source
|
|
stream3_.tail_length = 10 # shorter tail
|
|
stream3_.speed = 1800 # another speed
|
|
stream3_.priority = 6
|
|
# Add random bright flashes (like code highlights)
|
|
var code_flash_ = animation.twinkle_animation(engine)
|
|
code_flash_.color = 0xFF00FFAA # Bright cyan-green
|
|
code_flash_.density = 3 # density (few flashes)
|
|
code_flash_.twinkle_speed = 150 # twinkle speed (quick flash)
|
|
code_flash_.priority = 20
|
|
# Start all animations
|
|
engine.add(background_)
|
|
engine.add(stream1_)
|
|
engine.add(stream2_)
|
|
engine.add(stream3_)
|
|
engine.add(code_flash_)
|
|
engine.run()
|
|
|
|
|
|
#- Original DSL source:
|
|
# Matrix Rain - Digital rain effect
|
|
# Green cascading code like The Matrix
|
|
|
|
#strip length 60
|
|
|
|
# Dark background
|
|
color matrix_bg = 0x000000
|
|
animation background = solid(color=matrix_bg, priority=50)
|
|
|
|
# Define matrix green palette
|
|
palette matrix_greens = [
|
|
(0, 0x000000), # Black
|
|
(64, 0x003300), # Dark green
|
|
(128, 0x006600), # Medium green
|
|
(192, 0x00AA00), # Bright green
|
|
(255, 0x00FF00) # Neon green
|
|
]
|
|
|
|
# Create multiple cascading streams
|
|
color stream1_pattern = rich_palette(colors=matrix_greens, cycle_period=2s, transition_type=LINEAR, brightness=255)
|
|
animation stream1 = comet_animation(
|
|
color=stream1_pattern # color source
|
|
tail_length=15 # long tail
|
|
speed=1.5s # speed
|
|
priority = 10
|
|
)
|
|
|
|
|
|
color stream2_pattern = rich_palette(colors=matrix_greens, cycle_period=1.8s, transition_type=LINEAR, brightness=200)
|
|
animation stream2 = comet_animation(
|
|
color=stream2_pattern # color source
|
|
tail_length=12 # medium tail
|
|
speed=2.2s # different speed
|
|
priority = 8
|
|
)
|
|
|
|
color stream3_pattern = rich_palette(colors=matrix_greens, cycle_period=2.5s, transition_type=LINEAR, brightness=180)
|
|
animation stream3 = comet_animation(
|
|
color=stream3_pattern # color source
|
|
tail_length=10 # shorter tail
|
|
speed=1.8s # another speed
|
|
priority = 6
|
|
)
|
|
|
|
# Add random bright flashes (like code highlights)
|
|
animation code_flash = twinkle_animation(
|
|
color=0x00FFAA # Bright cyan-green
|
|
density=3 # density (few flashes)
|
|
twinkle_speed=150ms # twinkle speed (quick flash)
|
|
priority = 20
|
|
)
|
|
|
|
# Start all animations
|
|
run background
|
|
run stream1
|
|
run stream2
|
|
run stream3
|
|
run code_flash
|
|
-#
|