Tasmota/lib/libesp32/berry_animation/anim_examples/demo_value_meter.anim

30 lines
737 B
Plaintext

# Pattern of colors in the background based on palette, rotating over 5 s
berry """
def rand_meter(time_ms, self)
import math
var r = math.rand() % 101
return r
end
"""
extern function rand_meter
# 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
0xFC0000 # Red - need to add the first color at last position to ensure roll-over
]
# define a gradient across the whole strip
animation back_pattern = palette_meter(level = rand_meter())
run back_pattern