Temperature indicator

Hi everyone,
I’m trying to make and object move on the X axis with a temperature range between -30 / +50 °C (-22 / + 122 °F). The movement range is between position 135 and 185.
That is to say it has to move from 135 when temperature is at -30°C and 185 wheht it’s at 50°C.
Can someone help?

Weather unit tag is #WM#

Current temperature is #WCT#

Temp range C is 50 - -30 = 80

Temp range F is 122 - -22 = 144

X range is 185 -135 = 50

Scale C is 50 / 80 = 0.625 pixels per degree C

Scale F is 50 / 144 = 0.3472 pixels per degree F

X pos C is:
(135+clamp((#WCT#+30),0,80)*0.625)

X pos F is:
(135+clamp((#WCT#+22),0,144)*0.3472)

Combined expression
$#WM#==F?(135+clamp((#WCT#+22),0,144)*0.3472):(135+clamp((#WCT#+30),0,80)*0.625)$

I hope that helps.

5 Likes

Yes! That’s exactly what I needed. Thanks a lot.

1 Like

Here’s the face I wanted to create, check it out!

2 Likes

Mike another very welcome help Thank you for my part.

1 Like

good job

1 Like

Looking very good - the temperature indicator is great!

1 Like