[Leezard micro tip] Temperature indicator (including negative temp)

Hi all, here is a micro tip for a linear temperature indicator.
I started from @Tomaja tutorial for linear battery indicator

You’ll have to create two patterns, one for positive temp, and one for the negative temp.
The positive pattern has to be aligned on bottom, center


the negative one has to be aligned on top, centered

For this example, the “hot” pattern is 80 pix. high, and the “cold” is 50 pixels.

So, in “height” the basic formula should be :

“Hot temp”
(#WCT#*0.8)
(Temperature) * (height/100)
But… if temp is higher than 100 (damn hot but it can be !!), your bar will be higher than your mask !
So…
we’ll adding a conditionnal item : if temp >100, just indicate the total height of my mask. If its fewer, give me the right status :

$#WCT#>100?80:(#WCT#*0.8)$

“Cold” temp
same formula, but with the negative max height :

$#WCT#<(-30)?50:(#WCT#*0.5)$

Now, let’s get them transparent :

“hot”
$#WCT#>0?100:0$

“cold”
$#WCT#<0?100:0$

You can see the result here :

Hope it will help some of you !!

4 Likes

Well presented and clear. I am sure people will find it useful. :+1:

Fine explanation!