This week’s assignment tasked us with creating a generative text piece. I decided to take a slightly different, more artwork centered piece. I used one of my favorite books, “Before The Coffee Gets Cold” by Toshikazu Kawaguchi as an inspiration behind my piece. The book details may different relationships, and I used that as an inspiration for my piece. The code will generate a random paragraph from some predetermined sentences, and display it in the background, establishing a situation. The viewer can then click through the possible relationships it applies to, and try to see how the nature of the relationship may alter the meaning of the generated paragraph.
A section I am particularly proud of is the generation of said sentences, as they are constructed using the random() function, and as such provides different situations each time the page is refreshed.
//generating the text function generateText() { let openings = [ "'Oh gosh, is that the time? Sorry, I have to go,' the man mumbled evasively.", "'I didn't expect this conversation to go this way,' she admitted hesitantly.", "'Are you really leaving?' he asked, his voice barely above a whisper." ]; let middles = [ "She looked at him with uncertainty. The clocks in the café all showed different times, adding to the confusion.", "His fingers absentmindedly traced the rim of his coffee cup, avoiding her stare.", "The sepia-toned café seemed frozen in time, yet everything was changing for them." ]; let endings = [ "'Don’t I deserve an explanation?' she finally asked, breaking the silence.", "He sighed, glancing at his watch, knowing there was no easy answer.", "Without another word, he stood up and walked toward the exit, leaving her behind." ]; // Construct generative text generatedText = random(openings) + "\n\n" + random(middles) + "\n\n" + random(endings); }
The most frustrating part of this assignment definitely was creating each silhouette for the relationships. I wanted to make them seem organic and not blocky-looking, so I had to hardcode each shape into position, which was not difficult, but was definitely tedious. I want to research into whether there is a way to directly import unique shapes into p5.js so that I can save myself any future struggle similar to this. While the end result is good, this part by far took the longest and most concentration to complete.