Last active
August 29, 2015 14:05
-
-
Save elarkin/7be7da07ceb7e7ab7058 to your computer and use it in GitHub Desktop.
Slider balancing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Psuedocode | |
void OnSliderChange() { | |
int slider2val = Slider2.val(); | |
int slider3val = Slider3.val(); | |
float slider2proportion = slider2val / (slider2val + slider3val); | |
int totalRemaining = 180 - Slider1.val(); | |
Slider2.setValue((int) totalRemaining * slider2proportion); | |
Slider3.setValue(totalRemaining - Slider2.val()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment