You can solve the exercises either in the playground for p5.js at https://editor.p5js.org or by running this repo. The pro of this repo is that it's easy to send parameters to p5, in case you want to introduce variables such as sliders to adjust your sketches.
This repo is a boilerplate (create-react-app with Typescript, react-p5, and some other handy stuff) and a couple exercises and resources for getting started with generative art.
npm i
npm start
- Cheat sheet: https://bmoren.github.io/p5js-cheat-sheet/
- API docs: https://p5js.org/reference/
- Fill the background with a colour
- Create an evenly spaced grid across the page
- At each point in the grid, draw a 75%-filled pie chart shape at 0º, 90º, 180º or 270º rotation
- Using a 6x6 grid of evenly spaced points
- Connect two random points on the grid; forming a trapezoid with two parallel sides extending down to the baseline
- Set the same stroke color as your background
- Fill the trapezoid with a colour
- Repeat until all grid points are exhausted
- Layer the shapes by the average Y position of their two grid points so that the shortest shapes is drawn in front of the others