Name

constrain

Examples
draw <- function() {
    background(204)
    mx = constrain(mouseX, 30, 70)
    rect(mx - 10, 40, 20, 20)
}
Description Constrains a value to not exceed a maximum and minimum value.
Syntax
constrain(amt, low, high)
Parameters
amtint, or float: the value to constrain
lowint, or float: minimum limit
highint, or float: maximum limit
Related max
min
Creative Commons License