Berry animation more examples (#24258)
This commit is contained in:
parent
30a31f40c4
commit
46b9823af4
@ -3,6 +3,6 @@
|
|||||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||||
# PALETTE_RAINBOW defines 7 rainbow colors at roughly the same brightness
|
# PALETTE_RAINBOW defines 7 rainbow colors at roughly the same brightness
|
||||||
# PALETTE_RAINBOW_W adds 8th color white
|
# PALETTE_RAINBOW_W adds 8th color white
|
||||||
color rainbow_color = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=5s)
|
color rainbow_color = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=5s)
|
||||||
animation back = solid(color=rainbow_color)
|
animation back = solid(color=rainbow_color)
|
||||||
run back
|
run back
|
||||||
@ -14,7 +14,7 @@ palette rainbow_with_white = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||||
color rainbow_color = color_cycle(palette=rainbow_with_white, cycle_period=5s)
|
color rainbow_color = color_cycle(colors=rainbow_with_white, cycle_period=5s)
|
||||||
|
|
||||||
# Define a solid background with this dynamic color
|
# Define a solid background with this dynamic color
|
||||||
animation back = solid(color=rainbow_color)
|
animation back = solid(color=rainbow_color)
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
animation back = rich_palette_animation()
|
animation back = rich_palette_animation()
|
||||||
# Equivalent to
|
# Equivalent to
|
||||||
# animation back = rich_palette_animation(palette=PALETTE_PALETTE_RAINBOW, cycle_period=5s,
|
# animation back = rich_palette_animation(colors=PALETTE_PALETTE_RAINBOW, cycle_period=5s,
|
||||||
# transition_type=SINE, brightness=100%)
|
# transition_type=SINE, brightness=100%)
|
||||||
run back
|
run back
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||||
color rainbow_rich_color = rich_palette(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
|
|
||||||
# Define a gradient across the whole strip
|
# Define a gradient across the whole strip
|
||||||
animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color)
|
animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||||
color rainbow_rich_color = rich_palette(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
|
|
||||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
# 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()
|
set strip_len = strip_length()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||||
color rainbow_rich_color = rich_palette(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
|
|
||||||
# Because strip_length is dynamic, we need to map it to a variable and can't use the function directly in formulas
|
# 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()
|
set strip_len = strip_length()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||||
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
# 'cycle_period = 0' means that the colors don't change in time, only spatial change
|
||||||
color rainbow_rich_color = rich_palette(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
|
|
||||||
# define a gradient across the whole strip
|
# define a gradient across the whole strip
|
||||||
animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s)
|
animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ palette vue_meter_palette = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Define a color palette pattern for 'vue_meter_palette'
|
# Define a color palette pattern for 'vue_meter_palette'
|
||||||
color rainbow_rich_color = rich_palette(palette=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
||||||
|
|
||||||
# Define a sawtooth value from 0% to 100%
|
# Define a sawtooth value from 0% to 100%
|
||||||
set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s)
|
set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ palette vue_meter_palette = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Define a color palette pattern for 'vue_meter_palette'
|
# Define a color palette pattern for 'vue_meter_palette'
|
||||||
color rainbow_rich_color = rich_palette(palette=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
color rainbow_rich_color = rich_palette(colors=vue_meter_palette, cycle_period=0, transition_type=LINEAR)
|
||||||
|
|
||||||
# Define a vue-meter based on all elements above
|
# Define a vue-meter based on all elements above
|
||||||
animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter())
|
animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter())
|
||||||
|
|||||||
@ -16,7 +16,7 @@ run stars
|
|||||||
|
|
||||||
# We can combine a dynamic 'pos' value with a dynamic 'color'
|
# We can combine a dynamic 'pos' value with a dynamic 'color'
|
||||||
animation back = beacon_animation(
|
animation back = beacon_animation(
|
||||||
color = rich_palette(palette=PALETTE_RAINBOW_W2, cycle_period=5s)
|
color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s)
|
||||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = 5s)
|
||||||
beacon_size = 3 # small 3 pixels eye
|
beacon_size = 3 # small 3 pixels eye
|
||||||
slew_size = 2 # with 2 pixel shading around
|
slew_size = 2 # with 2 pixel shading around
|
||||||
|
|||||||
@ -8,7 +8,7 @@ set strip_len = strip_length()
|
|||||||
# Define a pattern that goes from red to blue to red across the strip
|
# Define a pattern that goes from red to blue to red across the strip
|
||||||
palette red_blue_red_palette = [ red, 0x3333FF, red ]
|
palette red_blue_red_palette = [ red, 0x3333FF, red ]
|
||||||
# Embed this raw palette into a rich_palette color provider
|
# Embed this raw palette into a rich_palette color provider
|
||||||
color red_blue_red_color = rich_palette(palette=red_blue_red_palette)
|
color red_blue_red_color = rich_palette(colors=red_blue_red_palette)
|
||||||
|
|
||||||
# Define a moving beacon to be used as an opacity mask
|
# Define a moving beacon to be used as an opacity mask
|
||||||
animation moving_eye = beacon_animation(
|
animation moving_eye = beacon_animation(
|
||||||
|
|||||||
@ -12,8 +12,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
|||||||
|
|
||||||
# Define 2 color providers cycling through palette rainbow with white
|
# Define 2 color providers cycling through palette rainbow with white
|
||||||
# 'col2' is shifted by 1 color from 'col1'
|
# 'col2' is shifted by 1 color from 'col1'
|
||||||
color col1 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
color col2 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||||
|
|
||||||
# Using beacon_animation to move a shutter from left to right
|
# Using beacon_animation to move a shutter from left to right
|
||||||
|
|||||||
@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
|||||||
|
|
||||||
# Define 2 color providers cycling through palette rainbow with white
|
# Define 2 color providers cycling through palette rainbow with white
|
||||||
# 'col2' is shifted by 1 color from 'col1'
|
# 'col2' is shifted by 1 color from 'col1'
|
||||||
color col1 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
color col2 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||||
|
|
||||||
# Using beacon_animation to move a shutter from in to out
|
# Using beacon_animation to move a shutter from in to out
|
||||||
|
|||||||
@ -13,8 +13,8 @@ set shutter_size = sawtooth(min_value = 0, max_value = strip_len,
|
|||||||
|
|
||||||
# Define 2 color providers cycling through palette rainbow with white
|
# Define 2 color providers cycling through palette rainbow with white
|
||||||
# 'col2' is shifted by 1 color from 'col1'
|
# 'col2' is shifted by 1 color from 'col1'
|
||||||
color col1 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col1 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
color col2 = color_cycle(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color col2 = color_cycle(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
col2.next = 1 # Writing 1 to 'next' actually advances the color
|
||||||
|
|
||||||
# Using beacon_animation to move a shutter from in to out
|
# Using beacon_animation to move a shutter from in to out
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# @desc Crenel static with variable color
|
# @desc Crenel static with variable color
|
||||||
|
|
||||||
# Define a color attribute that cycles over time, cycle is 5 seconds
|
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||||
color rainbow_color = rich_palette(palette=PALETTE_RAINBOW_W2, cycle_period=5s)
|
color rainbow_color = rich_palette(colors=PALETTE_RAINBOW_W2, cycle_period=5s)
|
||||||
|
|
||||||
# Define a simple crenel 2+2
|
# Define a simple crenel 2+2
|
||||||
animation back = crenel_animation(
|
animation back = crenel_animation(
|
||||||
|
|||||||
@ -13,7 +13,7 @@ animation mask = crenel_animation(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
# Define a smooth palette using PALETTE_RAINBOW_W (7 colors + white)
|
||||||
color rainbow_rich_color = rich_palette(palette=PALETTE_RAINBOW_W, cycle_period=0)
|
color rainbow_rich_color = rich_palette(colors=PALETTE_RAINBOW_W, cycle_period=0)
|
||||||
# Define a gradient across the whole strip and use crenel as opacity mask
|
# Define a gradient across the whole strip and use crenel as opacity mask
|
||||||
animation pattern = palette_gradient_animation(
|
animation pattern = palette_gradient_animation(
|
||||||
color_source = rainbow_rich_color # use the rainow pattern
|
color_source = rainbow_rich_color # use the rainow pattern
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
# @desc Cylon-style scanning eye using template with customizable color
|
# @desc Template example fir Cylon-style scanning eye
|
||||||
|
|
||||||
|
# Define a full template with parameters: eye_color, back_color, period, priority
|
||||||
template animation cylon_eye {
|
template animation cylon_eye {
|
||||||
param eye_color type color default red
|
param eye_color type color default red
|
||||||
param back_color type color default transparent
|
param back_color type color default transparent
|
||||||
param period type time default 5s
|
param period type time default 5s
|
||||||
|
param priority default 5
|
||||||
|
|
||||||
set strip_len = strip_length()
|
set strip_len = strip_length()
|
||||||
|
|
||||||
@ -13,11 +15,11 @@ template animation cylon_eye {
|
|||||||
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = period)
|
pos = cosine_osc(min_value = -1, max_value = strip_len - 2, duration = period)
|
||||||
beacon_size = 3 # small 3 pixels eye
|
beacon_size = 3 # small 3 pixels eye
|
||||||
slew_size = 2 # with 2 pixel shading around
|
slew_size = 2 # with 2 pixel shading around
|
||||||
priority = 5
|
priority = priority
|
||||||
)
|
)
|
||||||
|
|
||||||
run eye_animation
|
run eye_animation
|
||||||
}
|
}
|
||||||
|
|
||||||
animation eye = cylon_eye()
|
animation eye = cylon_eye()
|
||||||
run eye
|
run eye
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
# @desc Rainbow colors cycling with custom palette
|
||||||
|
|
||||||
|
# Define a full template with parameters: colors, cycle_period
|
||||||
|
template animation color_cycle2 {
|
||||||
|
param colors type palette
|
||||||
|
param cycle_period default 5s
|
||||||
|
|
||||||
|
# Define a color attribute that cycles over time, cycle is 5 seconds
|
||||||
|
color rainbow_color = color_cycle(colors=colors, cycle_period=cycle_period)
|
||||||
|
|
||||||
|
# Define a solid background with this dynamic color
|
||||||
|
animation back = solid(color=rainbow_color)
|
||||||
|
run back
|
||||||
|
}
|
||||||
|
|
||||||
|
palette rgb = [
|
||||||
|
0xFC0000 # Red
|
||||||
|
0x00FF00 # Green
|
||||||
|
0x0080FF # Blue
|
||||||
|
]
|
||||||
|
|
||||||
|
animation main = color_cycle2(colors = rgb, cycle_period = 2s)
|
||||||
|
run main
|
||||||
@ -1,65 +0,0 @@
|
|||||||
# @desc Bidirectional shutter effect with rainbow colors
|
|
||||||
|
|
||||||
template animation shutter_bidir {
|
|
||||||
param colors type palette
|
|
||||||
param period default 5s
|
|
||||||
|
|
||||||
set strip_len = strip_length()
|
|
||||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
|
||||||
|
|
||||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
|
||||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
|
||||||
col2.next = 1
|
|
||||||
|
|
||||||
# shutter moving from left to right
|
|
||||||
animation shutter_lr_animation = beacon_animation(
|
|
||||||
color = col2
|
|
||||||
back_color = col1
|
|
||||||
pos = 0
|
|
||||||
beacon_size = shutter_size
|
|
||||||
slew_size = 0
|
|
||||||
priority = 5
|
|
||||||
)
|
|
||||||
|
|
||||||
# shutter moving from right to left
|
|
||||||
animation shutter_rl_animation = beacon_animation(
|
|
||||||
color = col1
|
|
||||||
back_color = col2
|
|
||||||
pos = 0
|
|
||||||
beacon_size = strip_len - shutter_size
|
|
||||||
slew_size = 0
|
|
||||||
priority = 5
|
|
||||||
)
|
|
||||||
|
|
||||||
sequence shutter_seq repeat forever {
|
|
||||||
repeat col1.palette_size times {
|
|
||||||
restart shutter_size
|
|
||||||
play shutter_lr_animation for period
|
|
||||||
col1.next = 1
|
|
||||||
col2.next = 1
|
|
||||||
}
|
|
||||||
repeat col1.palette_size times {
|
|
||||||
restart shutter_size
|
|
||||||
play shutter_rl_animation for period
|
|
||||||
col1.next = 1
|
|
||||||
col2.next = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run shutter_seq
|
|
||||||
}
|
|
||||||
|
|
||||||
# define a palette of rainbow colors including white with constant brightness
|
|
||||||
palette rainbow_with_white = [
|
|
||||||
0xFC0000 # Red
|
|
||||||
0xFF8000 # Orange
|
|
||||||
0xFFFF00 # Yellow
|
|
||||||
0x00FF00 # Green
|
|
||||||
0x00FFFF # Cyan
|
|
||||||
0x0080FF # Blue
|
|
||||||
0x8000FF # Violet
|
|
||||||
0xCCCCCC # White
|
|
||||||
]
|
|
||||||
|
|
||||||
animation main = shutter_bidir(colors = rainbow_with_white, period = 1.5s)
|
|
||||||
run main
|
|
||||||
@ -1,24 +1,26 @@
|
|||||||
# @desc Advanced shutter template with ascending/descending flags
|
# @desc Template to illustrate the parameters and flags
|
||||||
|
|
||||||
|
# Define a template to package the shutter in-out-in from 6.40
|
||||||
|
# with flags to enable or disable in-out or out-in
|
||||||
template animation shutter_bidir {
|
template animation shutter_bidir {
|
||||||
param colors type palette
|
param colors type palette
|
||||||
param period default 2s
|
param period default 2s
|
||||||
param ascending type bool default true # define to true to enable 'ascending' part
|
param inout type bool default true # define to true to enable 'inout' part
|
||||||
param descending type bool default true # define to true to enable 'descending' part
|
param outin type bool default true # define to true to enable 'outin' part
|
||||||
|
|
||||||
# since 'strip_length()' is a value provider, it must be assigned to a variable before being used
|
# since 'strip_length()' is a value provider, it must be assigned to a variable before being used
|
||||||
set strip_len = strip_length()
|
set strip_len = strip_length()
|
||||||
|
|
||||||
# animated value for the size of the shutter, evolving linearly in time (sawtooth from 0% to 100%)
|
# Define animated value for the size of the shutter, evolving linearly in time (sawtooth from 0% to 100%)
|
||||||
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
set shutter_size = sawtooth(min_value = 0, max_value = strip_len, duration = period)
|
||||||
|
|
||||||
# define two rotating palettes, shifted by one color
|
# Define two rotating palettes, shifted by one color
|
||||||
color col1 = color_cycle(palette=colors, cycle_period=0)
|
color col1 = color_cycle(colors=colors, cycle_period=0)
|
||||||
color col2 = color_cycle(palette=colors, cycle_period=0)
|
color col2 = color_cycle(colors=colors, cycle_period=0)
|
||||||
col2.next = 1 # move 'col2' to the next color so it's shifte by one compared to 'col1'
|
col2.next = 1 # move 'col2' to the next color so it's shifte by one compared to 'col1'
|
||||||
|
|
||||||
# shutter moving in ascending
|
# Shutter moving in in-out
|
||||||
animation shutter_lr_animation = beacon_animation(
|
animation shutter_inout_animation = beacon_animation(
|
||||||
color = col2
|
color = col2
|
||||||
back_color = col1
|
back_color = col1
|
||||||
pos = 0
|
pos = 0
|
||||||
@ -27,8 +29,8 @@ template animation shutter_bidir {
|
|||||||
priority = 5
|
priority = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
# shutter moving in descending
|
# shutter moving in out-in
|
||||||
animation shutter_rl_animation = beacon_animation(
|
animation shutter_outin_animation = beacon_animation(
|
||||||
color = col1
|
color = col1
|
||||||
back_color = col2
|
back_color = col2
|
||||||
pos = 0
|
pos = 0
|
||||||
@ -40,24 +42,23 @@ template animation shutter_bidir {
|
|||||||
# this is the overall sequence composed of two sub-sequences
|
# this is the overall sequence composed of two sub-sequences
|
||||||
# the first in ascending mode, the second in descending
|
# the first in ascending mode, the second in descending
|
||||||
sequence shutter_seq repeat forever {
|
sequence shutter_seq repeat forever {
|
||||||
if ascending { # un only if 'ascending' is true
|
if inout { # un only if 'ascending' is true
|
||||||
repeat col1.palette_size times { # run the shutter animation
|
repeat col1.palette_size times { # run the shutter animation
|
||||||
restart shutter_size # resync all times for this animation, to avoid temporal drift
|
restart shutter_size # resync all times for this animation, to avoid temporal drift
|
||||||
play shutter_lr_animation for period # run the animation
|
play shutter_inout_animation for period # run the animation
|
||||||
col1.next = 1 # then move to next color for both palettes
|
col1.next = 1 # then move to next color for both palettes
|
||||||
col2.next = 1
|
col2.next = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if descending { # run only if 'descending' is true
|
if outin { # run only if 'descending' is true
|
||||||
repeat col1.palette_size times {
|
repeat col1.palette_size times {
|
||||||
restart shutter_size
|
restart shutter_size
|
||||||
play shutter_rl_animation for period
|
play shutter_outin_animation for period
|
||||||
col1.next = 1
|
col1.next = 1
|
||||||
col2.next = 1
|
col2.next = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run shutter_seq
|
run shutter_seq
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,4 +75,4 @@ palette rainbow_with_white = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
animation main = shutter_bidir(colors = rainbow_with_white, period = 1.5s)
|
animation main = shutter_bidir(colors = rainbow_with_white, period = 1.5s)
|
||||||
run main
|
run main
|
||||||
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_10.png
Normal file
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_10.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_20.png
Normal file
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_20.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_30.png
Normal file
BIN
lib/libesp32/berry_animation/anim_tutorials/png/chap_8_30.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@ -31,9 +31,6 @@ class ColorCycleColorProvider : animation.color_provider
|
|||||||
# @param engine: AnimationEngine - Reference to the animation engine (required)
|
# @param engine: AnimationEngine - Reference to the animation engine (required)
|
||||||
def init(engine)
|
def init(engine)
|
||||||
super(self).init(engine) # Initialize parameter system
|
super(self).init(engine) # Initialize parameter system
|
||||||
|
|
||||||
# Set the default palette
|
|
||||||
self.palette = animation.PALETTE_RAINBOW
|
|
||||||
|
|
||||||
# Initialize non-parameter instance variables
|
# Initialize non-parameter instance variables
|
||||||
self.current_index = 0 # Start at first color
|
self.current_index = 0 # Start at first color
|
||||||
@ -71,7 +68,12 @@ class ColorCycleColorProvider : animation.color_provider
|
|||||||
if name == "palette_size"
|
if name == "palette_size"
|
||||||
return self._get_palette_size()
|
return self._get_palette_size()
|
||||||
else
|
else
|
||||||
return super(self).member(name)
|
var val = super(self).member(name)
|
||||||
|
# If 'palette' is 'nil', default to 'animation.PALETTE_RAINBOW'
|
||||||
|
if name == "palette" && val == nil
|
||||||
|
val = animation.PALETTE_RAINBOW
|
||||||
|
end
|
||||||
|
return val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3744,9 +3744,9 @@ static const bvalue be_ktab_class_ColorCycleColorProvider[27] = {
|
|||||||
/* K19 */ be_nested_str_weak(next),
|
/* K19 */ be_nested_str_weak(next),
|
||||||
/* K20 */ be_nested_str_weak(_adjust_index),
|
/* K20 */ be_nested_str_weak(_adjust_index),
|
||||||
/* K21 */ be_nested_str_weak(member),
|
/* K21 */ be_nested_str_weak(member),
|
||||||
/* K22 */ be_nested_str_weak(init),
|
/* K22 */ be_nested_str_weak(animation),
|
||||||
/* K23 */ be_nested_str_weak(animation),
|
/* K23 */ be_nested_str_weak(PALETTE_RAINBOW),
|
||||||
/* K24 */ be_nested_str_weak(PALETTE_RAINBOW),
|
/* K24 */ be_nested_str_weak(init),
|
||||||
/* K25 */ be_nested_str_weak(get),
|
/* K25 */ be_nested_str_weak(get),
|
||||||
/* K26 */ be_const_int(-16777216),
|
/* K26 */ be_const_int(-16777216),
|
||||||
};
|
};
|
||||||
@ -4003,21 +4003,28 @@ be_local_closure(class_ColorCycleColorProvider_member, /* name */
|
|||||||
&be_ktab_class_ColorCycleColorProvider, /* shared constants */
|
&be_ktab_class_ColorCycleColorProvider, /* shared constants */
|
||||||
be_str_weak(member),
|
be_str_weak(member),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[14]) { /* code */
|
( &(const binstruction[21]) { /* code */
|
||||||
0x1C08030F, // 0000 EQ R2 R1 K15
|
0x1C08030F, // 0000 EQ R2 R1 K15
|
||||||
0x780A0003, // 0001 JMPF R2 #0006
|
0x780A0003, // 0001 JMPF R2 #0006
|
||||||
0x8C080101, // 0002 GETMET R2 R0 K1
|
0x8C080101, // 0002 GETMET R2 R0 K1
|
||||||
0x7C080200, // 0003 CALL R2 1
|
0x7C080200, // 0003 CALL R2 1
|
||||||
0x80040400, // 0004 RET 1 R2
|
0x80040400, // 0004 RET 1 R2
|
||||||
0x70020006, // 0005 JMP #000D
|
0x7002000D, // 0005 JMP #0014
|
||||||
0x60080003, // 0006 GETGBL R2 G3
|
0x60080003, // 0006 GETGBL R2 G3
|
||||||
0x5C0C0000, // 0007 MOVE R3 R0
|
0x5C0C0000, // 0007 MOVE R3 R0
|
||||||
0x7C080200, // 0008 CALL R2 1
|
0x7C080200, // 0008 CALL R2 1
|
||||||
0x8C080515, // 0009 GETMET R2 R2 K21
|
0x8C080515, // 0009 GETMET R2 R2 K21
|
||||||
0x5C100200, // 000A MOVE R4 R1
|
0x5C100200, // 000A MOVE R4 R1
|
||||||
0x7C080400, // 000B CALL R2 2
|
0x7C080400, // 000B CALL R2 2
|
||||||
0x80040400, // 000C RET 1 R2
|
0x1C0C030D, // 000C EQ R3 R1 K13
|
||||||
0x80000000, // 000D RET 0
|
0x780E0004, // 000D JMPF R3 #0013
|
||||||
|
0x4C0C0000, // 000E LDNIL R3
|
||||||
|
0x1C0C0403, // 000F EQ R3 R2 R3
|
||||||
|
0x780E0001, // 0010 JMPF R3 #0013
|
||||||
|
0xB80E2C00, // 0011 GETNGBL R3 K22
|
||||||
|
0x88080717, // 0012 GETMBR R2 R3 K23
|
||||||
|
0x80040400, // 0013 RET 1 R2
|
||||||
|
0x80000000, // 0014 RET 0
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -4116,22 +4123,19 @@ be_local_closure(class_ColorCycleColorProvider_init, /* name */
|
|||||||
&be_ktab_class_ColorCycleColorProvider, /* shared constants */
|
&be_ktab_class_ColorCycleColorProvider, /* shared constants */
|
||||||
be_str_weak(init),
|
be_str_weak(init),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[15]) { /* code */
|
( &(const binstruction[12]) { /* code */
|
||||||
0x60080003, // 0000 GETGBL R2 G3
|
0x60080003, // 0000 GETGBL R2 G3
|
||||||
0x5C0C0000, // 0001 MOVE R3 R0
|
0x5C0C0000, // 0001 MOVE R3 R0
|
||||||
0x7C080200, // 0002 CALL R2 1
|
0x7C080200, // 0002 CALL R2 1
|
||||||
0x8C080516, // 0003 GETMET R2 R2 K22
|
0x8C080518, // 0003 GETMET R2 R2 K24
|
||||||
0x5C100200, // 0004 MOVE R4 R1
|
0x5C100200, // 0004 MOVE R4 R1
|
||||||
0x7C080400, // 0005 CALL R2 2
|
0x7C080400, // 0005 CALL R2 2
|
||||||
0xB80A2E00, // 0006 GETNGBL R2 K23
|
0x90020903, // 0006 SETMBR R0 K4 K3
|
||||||
0x88080518, // 0007 GETMBR R2 R2 K24
|
0x88080110, // 0007 GETMBR R2 R0 K16
|
||||||
0x90021A02, // 0008 SETMBR R0 K13 R2
|
0x8C0C0101, // 0008 GETMET R3 R0 K1
|
||||||
0x90020903, // 0009 SETMBR R0 K4 K3
|
0x7C0C0200, // 0009 CALL R3 1
|
||||||
0x88080110, // 000A GETMBR R2 R0 K16
|
0x980A1E03, // 000A SETIDX R2 K15 R3
|
||||||
0x8C0C0101, // 000B GETMET R3 R0 K1
|
0x80000000, // 000B RET 0
|
||||||
0x7C0C0200, // 000C CALL R3 1
|
|
||||||
0x980A1E03, // 000D SETIDX R2 K15 R3
|
|
||||||
0x80000000, // 000E RET 0
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user