Tasmota/lib/libesp32/berry_animation/anim_examples/demo_value_meter.anim
s-hadinger 8feff1148a
Berry animation meter (#24193)
* Remove tab from json

* Berry animation meter and other optimizations
2025-12-06 16:52:43 +01:00

30 lines
747 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_animation(level = rand_meter())
run back_pattern