Created
February 22, 2023 20:57
-
-
Save Kpeved/9728a0d29e29b1ad2a2cd3db75ca0e7e to your computer and use it in GitHub Desktop.
This file contains 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
//Function which calculates the length of the clock hand | |
private fun calculateClockHandLength(maxHeight: Float, currentHour: Int): Float { | |
val stepHeight = maxHeight / 12 | |
// Height decreases first 360 deg, then increases again | |
return stepHeight * if (currentHour < 12) { | |
12 - 1 - currentHour | |
} else { | |
currentHour - 12 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment