Berry animation update tutorials (#24255)
@ -0,0 +1,6 @@
|
||||
# @desc Static beacon
|
||||
|
||||
# Simple beacon starting at pixel 6 with size of 7 pixels, no border
|
||||
animation back = beacon_animation(back_color = blue, color = red,
|
||||
pos = 5, beacon_size = 7)
|
||||
run back
|
||||
@ -0,0 +1,6 @@
|
||||
# @desc Static beacon with slew
|
||||
|
||||
# Simple beacon starting at pixel 6 with size of 7 pixels, no border
|
||||
animation back = beacon_animation(back_color = blue, color = red,
|
||||
pos = 5, beacon_size = 7, slew_size = 3)
|
||||
run back
|
||||
@ -0,0 +1,9 @@
|
||||
# @desc Static beacon with oscillating slew
|
||||
|
||||
# Define an oscillating value from 0 to 4 and back to 0 in 2 seconds
|
||||
set slew = cosine_osc(min_value = 0, max_value = 4, duration = 2s)
|
||||
|
||||
# Simple beacon starting at pixel 6 with size of 7 pixels, no border
|
||||
animation back = beacon_animation(back_color = blue, color = red,
|
||||
pos = 5, beacon_size = 7, slew_size = slew)
|
||||
run back
|
||||
@ -0,0 +1,13 @@
|
||||
# @desc Moving red beacon - Cylon style
|
||||
|
||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
||||
set strip_len = strip_length()
|
||||
|
||||
# In this example, the 'cosine_osc' is created within the call
|
||||
animation back = beacon_animation(
|
||||
color = red
|
||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
||||
beacon_size = 3 # small 3 pixels eye
|
||||
slew_size = 2 # with 2 pixel shading around
|
||||
)
|
||||
run back
|
||||
@ -0,0 +1,25 @@
|
||||
# @desc Moving rainbow beacon and stars
|
||||
# In this example we combine a Twinkle star as background,
|
||||
# a moving beacon with a dynamic color using the rainbow palette
|
||||
|
||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
||||
set strip_len = strip_length()
|
||||
|
||||
animation stars = twinkle_animation(
|
||||
color=0xFFFFAA # Light yellow sparkles
|
||||
density=2 # density (moderate sparkles)
|
||||
twinkle_speed=100ms # twinkle speed
|
||||
fade_speed=100 # when no unit, time unit is 'ms'
|
||||
# priority = 10 # this is the implicit priority
|
||||
)
|
||||
run stars
|
||||
|
||||
# We can combine a dynamic 'pos' value with a dynamic 'color'
|
||||
animation back = beacon_animation(
|
||||
color = rich_palette(palette=PALETTE_RAINBOW_W2, cycle_period=5s)
|
||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
||||
beacon_size = 3 # small 3 pixels eye
|
||||
slew_size = 2 # with 2 pixel shading around
|
||||
priority = 5 # priority below 10 so it's on top of twinkle
|
||||
)
|
||||
run back
|
||||
@ -0,0 +1,27 @@
|
||||
# @desc Moving beacon used as opacity filter on pattern
|
||||
# In this example we use the moving beacon as an opacity mask
|
||||
# on top of a pattern
|
||||
|
||||
# Define 'strip_len' to make calculations
|
||||
set strip_len = strip_length()
|
||||
|
||||
# Define a pattern that goes from red to blue to red across the strip
|
||||
palette red_blue_red_palette = [ red, 0x3333FF, red ]
|
||||
# Embed this raw palette into a rich_palette color provider
|
||||
color red_blue_red_color = rich_palette(palette=red_blue_red_palette)
|
||||
|
||||
# Define a moving beacon to be used as an opacity mask
|
||||
animation moving_eye = beacon_animation(
|
||||
color = white # the color is not important, only the opacity counts here
|
||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
||||
beacon_size = 3 # small 3 pixels eye
|
||||
slew_size = 2 # with 2 pixel shading around
|
||||
)
|
||||
|
||||
# The palette gradient animation is used with an animation as opacity
|
||||
animation eye_pattern = palette_gradient_animation(
|
||||
color_source = red_blue_red_color # the beacon animation used as opacity
|
||||
# spatial_period = strip_len # implicit
|
||||
opacity = moving_eye
|
||||
)
|
||||
run eye_pattern
|
||||
@ -0,0 +1,17 @@
|
||||
# @desc Shutter left to right using beacon
|
||||
|
||||
# Define 'strip_len' to make calculations
|
||||
set strip_len = strip_length()
|
||||
|
||||
# Define shutter_size as a sawtootgh from 0 to strip_len
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
||||
duration = 1.5s)
|
||||
|
||||
# Using beacon_animation to move a shutter from left to right
|
||||
animation shutter_lr_animation = beacon_animation(
|
||||
color = red
|
||||
back_color = blue
|
||||
pos = 0 # Start from position 0 (left)
|
||||
beacon_size = shutter_size # Oscillating size from 0 to strip_len
|
||||
)
|
||||
run shutter_lr_animation
|
||||
@ -0,0 +1,35 @@
|
||||
# @desc Shutter left to right with rotating colors, using sequence
|
||||
|
||||
# Define 'strip_len' to make calculations
|
||||
set strip_len = strip_length()
|
||||
|
||||
# Set a global variable for 'period'
|
||||
set period = 1.5s
|
||||
|
||||
# Define shutter_size as a sawtootgh from 0 to strip_len
|
||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
||||
duration = period)
|
||||
|
||||
# Define 2 color providers cycling through palette rainbow with white
|
||||
# 'col2' is shifted by 1 color from 'col1'
|
||||
color col1 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
color col2 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||
|
||||
# Using beacon_animation to move a shutter from left to right
|
||||
animation shutter_lr_animation = beacon_animation(
|
||||
color = col2 # Use two rotating colors
|
||||
back_color = col1 # Use two rotating colors
|
||||
pos = 0 # Start from position 0 (left)
|
||||
beacon_size = shutter_size
|
||||
# Oscillating size from 0 to strip_len
|
||||
)
|
||||
|
||||
# Define a sequence running forever
|
||||
sequence shutter_seq repeat forever {
|
||||
restart shutter_size # Make sure that shutter_size is synced with the sequence
|
||||
play shutter_lr_animation for period # Play animation
|
||||
col1.next = 1 # set 'col1' to next color
|
||||
col2.next = 1 # set 'col2' to next color
|
||||
}
|
||||
run shutter_seq
|
||||
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_1_10.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_1_20.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_1_30.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_1_40.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_1_50.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_2_10.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_2_20.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_3_10.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_3_20.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_10.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_12.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_15.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_18.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_30.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_4_35.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_10.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_15.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_20.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_30.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_40.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_5_50.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_6_10.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_6_20.png
Normal file
|
After Width: | Height: | Size: 23 KiB |