Im a developer that likes maths, but dont have much experience,
I had constructed a graphic that animates a bar that grows on the X axis according to a value.
So, I have the values for the x positions of the bar, and the thresholds for the values,
xPosition 13|----------------|105 [x position to find] Value 0|----------------|20 [known value]
so, value = 0 should be showed in xPosition = 13... and value = 20 should be showed in xPosition = 105.
The formula I use for figuring this out:: [92 = 105-13; 20 = 20 - 0]
xPos = [value * 92/20] + 13
Which is Ok and works properly,
but when I go to other tresholds, i have to use some "magical" values
ie:
xPosition 105|----------------|380 [x position to find] Value 20|----------------|150 [known value]
275 = 380-105 ; 130 = 150 -20;; steps
xPos = [value * 275/130] + 62
So where does this "62", comes from? [105-20 = 85]
Im doing other graphs with same formula, all works, but i have to use this "magic" number, that i havent understood where it comes from?
Hope i make sense ;) Thanks!