top of page
  • Writer's pictureKJ Ha

Computational Pattern


I was inspired by the above image I found on Pinterest (https://www.pinterest.com/pin/651544271071767887/) and I would like to create a similar pattern with p5.js. I particularly found this image intriguing because I felt there is something special about the rhombus, the rectangle whose four sides have the same length.








Declaring variables. I haven't assigned any values for j and k since I wanted to add some random elements that can be changed by the user interacting with the sketch.
















First, I declared a function named Rect to create multiple rhombi at once. The result is the image below.













I should've done a better job at finding a more elegant and computational way to call different functions; however, I just went through a trial and error method, to create somewhat visually interesting compositions.







When the mouse has clicked the values of j and k will be randomized.










bottom of page