I have a slider that needs to adjust 3 variables.
The slider min val is 0, max is 100.
What is the math behind adjusting the variables accordingly as the slider is moved?
See images…
Any help appreciated!!




Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know about canvases but if you ask about just only the math that is easy:
If the sliders value is X:
A = 25 + max(50 – X, 0) / 2
B = 50 – abs(50 – X) / 2
C = 25 + max(X – 50, 0) /2
In javascript there is Math.max() and Math.abs() so a method for calculating this is:
Of course you could make an object for the result or do whatever you want with it, it’s just sample code.