Here you can find the source of clampPercentage(float value)
Parameter | Description |
---|---|
value | a parameter |
public static float clampPercentage(float value)
//package com.java2s; public class Main { /**/*from ww w . j a v a2 s . c om*/ * Clamps between 0 and 1, use full for percentages. * @param value * @return */ public static float clampPercentage(float value) { return clamp(value, 0f, 1f); } public static double clamp(double value, double min, double max) { return (value < min) ? min : ((value > max) ? max : value); } public static float clamp(float value, float min, float max) { return (value < min) ? min : ((value > max) ? max : value); } public static int clamp(int value, float min, float max) { return (int) clamp((float) value, min, max); } }