Water level monitor

Who can help me explain this as much as possible here, thank you in advance

This is a procedure that draws a colored rectangle on Canvas1,
centered 10 pixels above the bottom, thin line by thin line, from the bottom
to the top. for height of waterlevel, the input parameter.
The color chosen is red for low waterlevel (below 20), green for between 20 and 50, light blue over 50.

The loop could have been eliminated by setting the Canvas1 Line Width to the waterlevel, and drawing it in 1 stroke. (A little research would reveal the proper y value.)

P.S. There is a bug in this procedure. It fails to clear the Canvas, so the highest water level remains painted onto the canvas, like the inside of a commode tank (lift the lid if you dare.)

how can i design it to MIT App Inventor?

pls help me

what exactly are you talking about?
please elaborate, see here

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.