123 lines
4.3 KiB
Plaintext
123 lines
4.3 KiB
Plaintext
# Generated Berry code from Animation DSL
|
|
# Source: matrix_rain.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:
|
|
# # Matrix Rain - Digital rain effect
|
|
# # Green cascading code like The Matrix
|
|
#
|
|
# strip length 60
|
|
#
|
|
# # Dark background
|
|
# color matrix_bg = 0x000000
|
|
# animation background = solid(matrix_bg)
|
|
#
|
|
# # 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
|
|
# pattern stream1_pattern = rich_palette_color_provider(matrix_greens, 2s, linear, 255)
|
|
# animation stream1 = comet_animation(
|
|
# stream1_pattern, # color source
|
|
# 15, # long tail
|
|
# 1.5s # speed
|
|
# )
|
|
# stream1.priority = 10
|
|
#
|
|
# pattern stream2_pattern = rich_palette_color_provider(matrix_greens, 1.8s, linear, 200)
|
|
# animation stream2 = comet_animation(
|
|
# stream2_pattern, # color source
|
|
# 12, # medium tail
|
|
# 2.2s # different speed
|
|
# )
|
|
# stream2.priority = 8
|
|
#
|
|
# pattern stream3_pattern = rich_palette_color_provider(matrix_greens, 2.5s, linear, 180)
|
|
# animation stream3 = comet_animation(
|
|
# stream3_pattern, # color source
|
|
# 10, # shorter tail
|
|
# 1.8s # another speed
|
|
# )
|
|
# stream3.priority = 6
|
|
#
|
|
# # Add random bright flashes (like code highlights)
|
|
# animation code_flash = twinkle_animation(
|
|
# 0x00FFAA, # Bright cyan-green
|
|
# 3, # density (few flashes)
|
|
# 150ms # twinkle speed (quick flash)
|
|
# )
|
|
# code_flash.priority = 20
|
|
#
|
|
# # Start all animations
|
|
# run background
|
|
# run stream1
|
|
# run stream2
|
|
# run stream3
|
|
# run code_flash
|
|
|
|
import animation
|
|
|
|
# Matrix Rain - Digital rain effect
|
|
# Green cascading code like The Matrix
|
|
var engine = animation.init_strip(60)
|
|
# Dark background
|
|
var matrix_bg_ = 0xFF000000
|
|
var background_ = animation.solid(animation.global('matrix_bg_', 'matrix_bg'))
|
|
# Define matrix green palette
|
|
var matrix_greens_ = bytes("00000000" "40003300" "80006600" "C000AA00" "FF00FF00")
|
|
# Create multiple cascading streams
|
|
var stream1_pattern_ = animation.rich_palette_color_provider(animation.global('matrix_greens_', 'matrix_greens'), 2000, animation.global('linear_', 'linear'), 255)
|
|
var stream1_ = animation.comet_animation(animation.global('stream1_pattern_', 'stream1_pattern'), 15, 1500)
|
|
animation.global('stream1_').priority = 10
|
|
var stream2_pattern_ = animation.rich_palette_color_provider(animation.global('matrix_greens_', 'matrix_greens'), 1800, animation.global('linear_', 'linear'), 200)
|
|
var stream2_ = animation.comet_animation(animation.global('stream2_pattern_', 'stream2_pattern'), 12, 2200)
|
|
animation.global('stream2_').priority = 8
|
|
var stream3_pattern_ = animation.rich_palette_color_provider(animation.global('matrix_greens_', 'matrix_greens'), 2500, animation.global('linear_', 'linear'), 180)
|
|
var stream3_ = animation.comet_animation(animation.global('stream3_pattern_', 'stream3_pattern'), 10, 1800)
|
|
animation.global('stream3_').priority = 6
|
|
# Add random bright flashes (like code highlights)
|
|
var code_flash_ = animation.twinkle_animation(0xFF00FFAA, 3, 150)
|
|
animation.global('code_flash_').priority = 20
|
|
# Start all animations
|
|
# Start all animations/sequences
|
|
if global.contains('sequence_background')
|
|
var seq_manager = global.sequence_background()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('background_'))
|
|
end
|
|
if global.contains('sequence_stream1')
|
|
var seq_manager = global.sequence_stream1()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stream1_'))
|
|
end
|
|
if global.contains('sequence_stream2')
|
|
var seq_manager = global.sequence_stream2()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stream2_'))
|
|
end
|
|
if global.contains('sequence_stream3')
|
|
var seq_manager = global.sequence_stream3()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('stream3_'))
|
|
end
|
|
if global.contains('sequence_code_flash')
|
|
var seq_manager = global.sequence_code_flash()
|
|
engine.add_sequence_manager(seq_manager)
|
|
else
|
|
engine.add_animation(animation.global('code_flash_'))
|
|
end
|
|
engine.start()
|