rect()
The `rect()` function in p5.js is used to draw rectangles on the canvas, making it a foundational tool for creating shapes and forms in generative art and interactive experiences. Creative coders use `rect()` to build everything from simple graphics to complex interactive installations. For example, in a game that tests reaction times, rectangles can represent the interactive elements players need to engage with.
Try It with AI
The best way to learn rect() is to experiment with it using the AI assistant in p5js.ai.
Example prompts to try:
- "Explain what rect() does in p5.js"
- "Create a simple example using rect()"
- "Show me creative ways to use rect()"
Learn rect() Interactively
Use the p5js.ai editor to experiment with rect() using AI assistance.
๐ Full Interactive Tutorial on p5js.aiMore Resources
Tutorial provided by xelsed.ai, a research company focused on learning disabilities and AI.