diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_2_10_palette_rotation.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_2_10_palette_rotation.anim index c67652c79..e442b1aff 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_2_10_palette_rotation.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_2_10_palette_rotation.anim @@ -3,6 +3,6 @@ # 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_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) run back \ No newline at end of file diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_2_20_palette_rotation.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_2_20_palette_rotation.anim index b794a432b..bd7194b6f 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_2_20_palette_rotation.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_2_20_palette_rotation.anim @@ -14,7 +14,7 @@ palette rainbow_with_white = [ ] # 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 animation back = solid(color=rainbow_color) diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_3_10_color_transition.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_3_10_color_transition.anim index c8e94d536..7d20e8244 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_3_10_color_transition.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_3_10_color_transition.anim @@ -2,6 +2,6 @@ animation back = rich_palette_animation() # 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%) run back \ No newline at end of file diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_10_color_pattern.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_10_color_pattern.anim index 725e20acf..3d3b4743c 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_10_color_pattern.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_10_color_pattern.anim @@ -2,7 +2,7 @@ # 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 -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 animation back_pattern = palette_gradient_animation(color_source = rainbow_rich_color) diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_12_color_pattern_spatial_2.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_12_color_pattern_spatial_2.anim index f5c704fce..2b0593347 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_12_color_pattern_spatial_2.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_12_color_pattern_spatial_2.anim @@ -3,7 +3,7 @@ # 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 -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 set strip_len = strip_length() diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_15_color_pattern_spatial_osc.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_15_color_pattern_spatial_osc.anim index 77ac0b88a..2f8a3412a 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_15_color_pattern_spatial_osc.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_15_color_pattern_spatial_osc.anim @@ -2,7 +2,7 @@ # 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 -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 set strip_len = strip_length() diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_18_color_pattern_spatial_rotate.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_18_color_pattern_spatial_rotate.anim index 189b1a247..ea9df22fa 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_18_color_pattern_spatial_rotate.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_18_color_pattern_spatial_rotate.anim @@ -2,7 +2,7 @@ # 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 -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 animation back = palette_gradient_animation(color_source = rainbow_rich_color, shift_period = 5s) diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_30_color_pattern_meter.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_30_color_pattern_meter.anim index b3516240f..a14ffec65 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_30_color_pattern_meter.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_30_color_pattern_meter.anim @@ -13,7 +13,7 @@ palette 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% set level = sawtooth(min_value = 0%, max_value=100%, duration = 2s) diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_4_35_color_pattern_meter_random.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_4_35_color_pattern_meter_random.anim index 60ef64b30..c8a3e2676 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_4_35_color_pattern_meter_random.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_4_35_color_pattern_meter_random.anim @@ -24,7 +24,7 @@ palette 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 animation back = palette_meter_animation(color_source = rainbow_rich_color, level = rand_meter()) diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_5_40_cylon_rainbow.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_5_40_cylon_rainbow.anim index 5db22a77a..d8c303423 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_5_40_cylon_rainbow.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_5_40_cylon_rainbow.anim @@ -16,7 +16,7 @@ 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) + color = rich_palette(colors=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 diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_5_50_cylon_as_opacity.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_5_50_cylon_as_opacity.anim index b9462f1a8..e1e787c75 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_5_50_cylon_as_opacity.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_5_50_cylon_as_opacity.anim @@ -8,7 +8,7 @@ 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) +color red_blue_red_color = rich_palette(colors=red_blue_red_palette) # Define a moving beacon to be used as an opacity mask animation moving_eye = beacon_animation( diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_6_20_shutter_rotating_colors.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_6_20_shutter_rotating_colors.anim index cb79f842a..cfd6f1a3a 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_6_20_shutter_rotating_colors.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_6_20_shutter_rotating_colors.anim @@ -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 # '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) +color col1 = color_cycle(colors=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 # Using beacon_animation to move a shutter from left to right diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_6_30_shutter_central_rotating_colors.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_6_30_shutter_central_rotating_colors.anim index e78c061c6..4fca327c4 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_6_30_shutter_central_rotating_colors.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_6_30_shutter_central_rotating_colors.anim @@ -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 # '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) +color col1 = color_cycle(colors=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 # Using beacon_animation to move a shutter from in to out diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_6_40_shutter_central_inoutin.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_6_40_shutter_central_inoutin.anim index c3fe34f0c..9eb25cfac 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_6_40_shutter_central_inoutin.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_6_40_shutter_central_inoutin.anim @@ -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 # '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) +color col1 = color_cycle(colors=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 # Using beacon_animation to move a shutter from in to out diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_7_40_crenel_colors.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_7_40_crenel_colors.anim index 2567887f4..95cc99b21 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_7_40_crenel_colors.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_7_40_crenel_colors.anim @@ -1,7 +1,7 @@ # @desc Crenel static with variable color # 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 animation back = crenel_animation( diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_7_50_crenel_opacity.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_7_50_crenel_opacity.anim index 1ef3d328c..0a8fd8ece 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_7_50_crenel_opacity.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_7_50_crenel_opacity.anim @@ -13,7 +13,7 @@ animation mask = crenel_animation( ) # 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 animation pattern = palette_gradient_animation( color_source = rainbow_rich_color # use the rainow pattern diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_8_10_template_cylon_simple.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_8_10_template_cylon_simple.anim index ed51f8ef9..9606891f8 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_8_10_template_cylon_simple.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_8_10_template_cylon_simple.anim @@ -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 { param eye_color type color default red param back_color type color default transparent param period type time default 5s + param priority default 5 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) beacon_size = 3 # small 3 pixels eye slew_size = 2 # with 2 pixel shading around - priority = 5 + priority = priority ) run eye_animation } animation eye = cylon_eye() -run eye +run eye \ No newline at end of file diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_8_20_template_color_cycle.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_8_20_template_color_cycle.anim new file mode 100644 index 000000000..07b14638f --- /dev/null +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_8_20_template_color_cycle.anim @@ -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 \ No newline at end of file diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_8_21_template_shutter_bidir_flags.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_8_21_template_shutter_bidir_flags.anim deleted file mode 100644 index c9a781c2c..000000000 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_8_21_template_shutter_bidir_flags.anim +++ /dev/null @@ -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 diff --git a/lib/libesp32/berry_animation/anim_tutorials/chap_8_22_template_shutter_bidir.anim b/lib/libesp32/berry_animation/anim_tutorials/chap_8_30_template_shutter_bidir_flags.anim similarity index 61% rename from lib/libesp32/berry_animation/anim_tutorials/chap_8_22_template_shutter_bidir.anim rename to lib/libesp32/berry_animation/anim_tutorials/chap_8_30_template_shutter_bidir_flags.anim index 725c1c591..7f050e7ab 100644 --- a/lib/libesp32/berry_animation/anim_tutorials/chap_8_22_template_shutter_bidir.anim +++ b/lib/libesp32/berry_animation/anim_tutorials/chap_8_30_template_shutter_bidir_flags.anim @@ -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 { param colors type palette param period default 2s - param ascending type bool default true # define to true to enable 'ascending' part - param descending type bool default true # define to true to enable 'descending' part + param inout type bool default true # define to true to enable 'inout' 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 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) - # define two rotating palettes, shifted by one color - color col1 = color_cycle(palette=colors, cycle_period=0) - color col2 = color_cycle(palette=colors, cycle_period=0) + # Define two rotating palettes, shifted by one color + color col1 = color_cycle(colors=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' - # shutter moving in ascending - animation shutter_lr_animation = beacon_animation( + # Shutter moving in in-out + animation shutter_inout_animation = beacon_animation( color = col2 back_color = col1 pos = 0 @@ -27,8 +29,8 @@ template animation shutter_bidir { priority = 5 ) - # shutter moving in descending - animation shutter_rl_animation = beacon_animation( + # shutter moving in out-in + animation shutter_outin_animation = beacon_animation( color = col1 back_color = col2 pos = 0 @@ -40,24 +42,23 @@ template animation shutter_bidir { # this is the overall sequence composed of two sub-sequences # the first in ascending mode, the second in descending 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 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 col2.next = 1 } } - if descending { # run only if 'descending' is true + if outin { # run only if 'descending' is true repeat col1.palette_size times { restart shutter_size - play shutter_rl_animation for period + play shutter_outin_animation for period col1.next = 1 col2.next = 1 } } } - run shutter_seq } @@ -74,4 +75,4 @@ palette rainbow_with_white = [ ] animation main = shutter_bidir(colors = rainbow_with_white, period = 1.5s) -run main +run main \ No newline at end of file diff --git a/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_10.png b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_10.png new file mode 100644 index 000000000..d45876812 Binary files /dev/null and b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_10.png differ diff --git a/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_20.png b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_20.png new file mode 100644 index 000000000..d06b78def Binary files /dev/null and b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_20.png differ diff --git a/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_30.png b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_30.png new file mode 100644 index 000000000..e3ef5bea0 Binary files /dev/null and b/lib/libesp32/berry_animation/anim_tutorials/png/chap_8_30.png differ diff --git a/lib/libesp32/berry_animation/src/providers/color_cycle_color_provider.be b/lib/libesp32/berry_animation/src/providers/color_cycle_color_provider.be index 0f0fd6e70..31ecc36e2 100644 --- a/lib/libesp32/berry_animation/src/providers/color_cycle_color_provider.be +++ b/lib/libesp32/berry_animation/src/providers/color_cycle_color_provider.be @@ -31,9 +31,6 @@ class ColorCycleColorProvider : animation.color_provider # @param engine: AnimationEngine - Reference to the animation engine (required) def init(engine) super(self).init(engine) # Initialize parameter system - - # Set the default palette - self.palette = animation.PALETTE_RAINBOW # Initialize non-parameter instance variables self.current_index = 0 # Start at first color @@ -71,7 +68,12 @@ class ColorCycleColorProvider : animation.color_provider if name == "palette_size" return self._get_palette_size() 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 diff --git a/lib/libesp32/berry_animation/src/solidify/solidified_animation.h b/lib/libesp32/berry_animation/src/solidify/solidified_animation.h index f247030bb..b56c81477 100644 --- a/lib/libesp32/berry_animation/src/solidify/solidified_animation.h +++ b/lib/libesp32/berry_animation/src/solidify/solidified_animation.h @@ -3744,9 +3744,9 @@ static const bvalue be_ktab_class_ColorCycleColorProvider[27] = { /* K19 */ be_nested_str_weak(next), /* K20 */ be_nested_str_weak(_adjust_index), /* K21 */ be_nested_str_weak(member), - /* K22 */ be_nested_str_weak(init), - /* K23 */ be_nested_str_weak(animation), - /* K24 */ be_nested_str_weak(PALETTE_RAINBOW), + /* K22 */ be_nested_str_weak(animation), + /* K23 */ be_nested_str_weak(PALETTE_RAINBOW), + /* K24 */ be_nested_str_weak(init), /* K25 */ be_nested_str_weak(get), /* K26 */ be_const_int(-16777216), }; @@ -4003,21 +4003,28 @@ be_local_closure(class_ColorCycleColorProvider_member, /* name */ &be_ktab_class_ColorCycleColorProvider, /* shared constants */ be_str_weak(member), &be_const_str_solidified, - ( &(const binstruction[14]) { /* code */ + ( &(const binstruction[21]) { /* code */ 0x1C08030F, // 0000 EQ R2 R1 K15 0x780A0003, // 0001 JMPF R2 #0006 0x8C080101, // 0002 GETMET R2 R0 K1 0x7C080200, // 0003 CALL R2 1 0x80040400, // 0004 RET 1 R2 - 0x70020006, // 0005 JMP #000D + 0x7002000D, // 0005 JMP #0014 0x60080003, // 0006 GETGBL R2 G3 0x5C0C0000, // 0007 MOVE R3 R0 0x7C080200, // 0008 CALL R2 1 0x8C080515, // 0009 GETMET R2 R2 K21 0x5C100200, // 000A MOVE R4 R1 0x7C080400, // 000B CALL R2 2 - 0x80040400, // 000C RET 1 R2 - 0x80000000, // 000D RET 0 + 0x1C0C030D, // 000C EQ R3 R1 K13 + 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_str_weak(init), &be_const_str_solidified, - ( &(const binstruction[15]) { /* code */ + ( &(const binstruction[12]) { /* code */ 0x60080003, // 0000 GETGBL R2 G3 0x5C0C0000, // 0001 MOVE R3 R0 0x7C080200, // 0002 CALL R2 1 - 0x8C080516, // 0003 GETMET R2 R2 K22 + 0x8C080518, // 0003 GETMET R2 R2 K24 0x5C100200, // 0004 MOVE R4 R1 0x7C080400, // 0005 CALL R2 2 - 0xB80A2E00, // 0006 GETNGBL R2 K23 - 0x88080518, // 0007 GETMBR R2 R2 K24 - 0x90021A02, // 0008 SETMBR R0 K13 R2 - 0x90020903, // 0009 SETMBR R0 K4 K3 - 0x88080110, // 000A GETMBR R2 R0 K16 - 0x8C0C0101, // 000B GETMET R3 R0 K1 - 0x7C0C0200, // 000C CALL R3 1 - 0x980A1E03, // 000D SETIDX R2 K15 R3 - 0x80000000, // 000E RET 0 + 0x90020903, // 0006 SETMBR R0 K4 K3 + 0x88080110, // 0007 GETMBR R2 R0 K16 + 0x8C0C0101, // 0008 GETMET R3 R0 K1 + 0x7C0C0200, // 0009 CALL R3 1 + 0x980A1E03, // 000A SETIDX R2 K15 R3 + 0x80000000, // 000B RET 0 }) ) );