MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / drawBar

Function drawBar

examples/drivers/atoms3-imu/main.js:110–120  ·  view source on GitHub ↗
(label, value, x, y, width, height)

Source from the content-addressed store, hash-verified

108}
109
110function drawBar(label, value, x, y, width, height) {
111 const halfWidth = width >> 1;
112 const barWidth = (value * halfWidth) | 0;
113
114 if (value > 0)
115 render.fillRectangle(barColor, x + halfWidth, y, barWidth, height);
116 else
117 render.fillRectangle(barColor, x + halfWidth + barWidth, y, -barWidth, height);
118
119 render.drawText(label, font, textColor, x + 50, y);
120}
121
122function moveBallTo(x, y) {
123 const w = ball.width, h = ball.height;

Callers 1

onReadingFunction · 0.70

Calls 2

drawTextMethod · 0.80
fillRectangleMethod · 0.65

Tested by

no test coverage detected