how to clamp a value by modulus code example Example: how to clamp a value by modulus let d=max-min; let c=((value-min)%d)+min;