()
| 45 | let lightMode = true; |
| 46 | |
| 47 | function redraw() { |
| 48 | if (lightMode) { |
| 49 | backgroundColor = white; |
| 50 | foregroundColor = black; |
| 51 | stepColor = lightGray; |
| 52 | } else { |
| 53 | backgroundColor = black; |
| 54 | foregroundColor = white; |
| 55 | stepColor = darkGray; |
| 56 | } |
| 57 | render.begin(); |
| 58 | render.fillRectangle(backgroundColor, 0, 0, render.width, render.height); |
| 59 | let offset = (render.width-32)/2; |
| 60 | render.drawGray(steps, stepColor, 20, 7); |
| 61 | render.fillRectangle(stepColor, 10, render.height-17, render.width-20, render.height-17); |
| 62 | const fraction = stepCount / GOAL; |
| 63 | render.fillRectangle(barColor, 10, render.height-17, (render.width-20)*fraction, render.height-17); |
| 64 | render.drawGray(progressOverlay, backgroundColor, 0, render.height-17); |
| 65 | offset = (render.width-(render.getTextWidth(stepCount, bigFont)))/2; |
| 66 | render.drawText(stepCount, bigFont, foregroundColor, offset, 6); |
| 67 | render.drawText(goalStr, smallFont, foregroundColor, goalStrOffset, 41); |
| 68 | render.end(); |
| 69 | |
| 70 | } |
| 71 | |
| 72 | const imu = new device.sensor.IMU(); |
| 73 | let oldData = {x: 0, y: 0, z: 0, init: false}; |
no test coverage detected