percentage2Degrees function
Converts percentage
to degrees
.
The resulting Angle
confines the percent
to (-360, 360) by mod'ing
the incoming value.
Example:
print(percentage2Degrees(0.5)); // Output: 180
Implementation
double percentage2Degrees(num percent) {
return percent >= 0 || percent == -1.0
? (percent % 1.0) * 360
: ((percent % 1.0) - 1.0) * 360;
}