Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 777 Bytes

File metadata and controls

17 lines (15 loc) · 777 Bytes
featuredImage title oneLineDescription
../../../images/featured/06_Calculating_Values-03_Constrain-thumbnail.png
Constrain
Keep a number within a range.

This example draws a circle as the cursor's position but keeps the circle within a rectangle. It does so by passing the mouse's coordinates into the constrain() function.

Contributors from the p5 community wrote this example. Soon their names will appear here. In the meantime, you can <a href="https://github.com/processing/p5.js-website/blame/d6b28924185dac5e25c39cd0fc2fc4a1f6392883/src/content/examples/en/06_Calculating_Values/03_Constrain/code.js" target="_blank"

see their contributions in the source code.