widget: More prominent power consumption widget
Problem to solve
While the information is available at the battery widget, I'd like to see something we could overlay on top of the video, that would be useful for when you are focused on the video and/or navigating
Desired approach
I'm thinking of something that grows with the power consumption, and maybe turns redder as it grows, too. I bet @ES-Alexander can think of something cool
Additional context
No response
Prerequisites
- [x] I have checked to make sure that a similar request has not already been filed or fixed.
related to https://github.com/bluerobotics/cockpit/issues/343
The most relevant UI element I can think of is a gradient/vignette around the screen edges, with a center (and possibly rotation) that adjusts depending on the motion being represented. I think purple is a more appropriate "power" colour than red, because it's a common lightning colour, and red is likely better suited to collision indicators (like directional damage indicators in a first-person shooter game).
We could also consider having a radial sinusoid to make it more spiky instead of completely round.
Some examples:
Some example generating code
import numpy as np
import cv2
POINTS = 16
offset_x, offset_y = -0.2,0.1#0.1, 0.1
DROPOFF = 2
r, c = 1080, 1920
base = np.empty((r, c, 3), dtype=np.uint8)
base[:,:,:] = (170, 50, 8) # a nice blue as the background
overlay = np.empty_like(base)
overlay[:,:,:] = (100, 0, 100) # nice purple
x = np.linspace(-1, 1, c)
y = np.linspace(-1, 1, r)
xv, yv = np.meshgrid(x, y)
p = DROPOFF * 2
alpha = ((xv + offset_x)**p + (yv + offset_y)**p) * (np.sin(np.atan(xv/yv)*POINTS + np.pi/2)/2 + 0.5)
alpha -= alpha.min()
alpha /= alpha.max()
alpha = np.repeat(alpha[:,:,None], 3, axis=2)
bg = cv2.multiply(1-alpha, base.astype(float)).astype(np.uint8)
fg = cv2.multiply(alpha, overlay.astype(float)).astype(np.uint8)
img = cv2.add(bg, fg)
cv2.imshow('output', img)
key = cv2.waitKey(0)
if chr(key) == 's':
cv2.imwrite('offset-spikes.png', img)
cv2.destroyWindow('output')
Relevant to #1525.