Skip to content

Instantly share code, notes, and snippets.

@bevchou
Last active September 25, 2017 05:24
Show Gist options
  • Save bevchou/068390d28cc93fdf385afc9a738f34e9 to your computer and use it in GitHub Desktop.
Save bevchou/068390d28cc93fdf385afc9a738f34e9 to your computer and use it in GitHub Desktop.
//only change the color when not dragging and when it passes the stop angle
if (mouseAngle >= stopAngle || !dragging) {
changeCol = false;
} else {
changeCol = true;
}
//when slider position hits stop angle
if (angle > stopAngle) {
//change the color
if (changeCol) {
h += 20;
changeCol = false;
}
//reset the angle
angle = 0;
//reset the color to beginning
if (h >= 360) {
h = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment