constrain() Math Calculation Web & Application constrain_.jar void loop() { background(204); float mx = constrain(mouseX, 30, 70); rect(mx-10, 40, 20, 20); } Constrains a value to not exceed a maximum and minimum value. constrain(value, min, max) int or float: the value to constrain int or float: minimum limit int or float: maximum limit float or int (depending on the input values) max() min() 1.0 Function PDE