# Getting percent of height, vertical volume slider

ok I am having a brain fart right now and can't think straight. I've done this many times before.

I am making a vertical volume slider. The top of my slider track is at -80 and the bottom is -16. So my volume handle can slide between -80 and -16 on the Y axis.

-48 is basically 50%. I can't for the life of me figure out this percentage right now, can someone give me a little math help. I took math in summer school all 3 years of high school for a reason :P

## Answers

max = -80 min = -16 so total points in range = 64 so 50% of total = 64 / 2 = 32

Now starts moving up from -16. You get -48 when you move 32 (50%) points up.

So the percent for any value v (in positive) in range 16 to 80 is:

percent = (v - 16) / 64 * 100

For this example: (48 - 16) / 64 * 100 = 50