top of page
Blog: Blog2
Search

Haiku Generator - p5.js Sketch #4

  • Writer: anmonaco
    anmonaco
  • Dec 9, 2018
  • 1 min read

In class, we worked on creating a Haiku generator. To do this, we needed to do two main things, create an array and figure out how to make that array be random. In order to make it a haiku, we used two arrays. The first array was 5 syllables, and the next array was 7 syllables. Then we found out a way to use the random and math functions together to pic a random set of words from my array. The first challenge I faced was how to get the arrays to not repeat for the 7 syllables, so we set up a section called randomfive2 and still kept randomfive1.

After this was done, I just had to change the style of the words. Here we loaded in a specific font from google fonts to make the array look nice. The final product changes poems every time you reload!

Here is a link to my code: https://editor.p5js.org/anna10128/sketches/HyXvfTtA7


 
 
 

Comments


©2018 by Anna Monaco. Proudly created with Wix.com

  • facebook
  • twitter
  • linkedin
bottom of page