xxxxxxxxxx
84
let frq = ["sometimes", "often", "never", "always", "rarely", "once in a while", "occasionally"];
let mfrq;
let adj = ["big", "red", "heavy", "political", "yellow", "moral", "good", "wet", "silly", "charming", "cheerful", "clever", "clumsy", "important", "itchy", "magnificent", "obnoxious", "vivacious", "wicked", "zany"];
let madj;
let nounspl = ["plants", "dogs", "elephants", "mountains", "algorithms", "functions", "mappings", "years", "systems", "questions", "numbers", "groups", "stories", "books", "friends", "teachers", "mice", "sheep"];
let mnoun;
let verb = ["play", "work", "think", "believe", "calculate", "sit", "fight", "eat", "sleep", "cry", "sing", "short out", "lose", "pay"];
let mverb;
let adv = ["boldly", "bravely", "brightly", "busily", "calmly", "carefully","carelessly","cheerfully", "faithfully", "fast","fatally","fiercely","fondly","foolishly", "fortunately"];
let madv;
let place = ["on the shore", "in the office", "in nature", "in absence", "on the roof", "into the water", "in the yard", "over the hill", "behind you", "over there", "in the room", "overhead", "among the stars", "in the clouds", "in between things"];
let mplace;
let off = 100;
let sz = 80;
function setup() {
createCanvas(800, 800);
textAlign(CENTER);
textSize(sz);
frameRate(5);
mfrq = random(frq);
madj = random(adj);
mnoun = random(nounspl);
mverb = random(verb);
madv = random(adv);
mplace = random(place);
textFont("Times New Roman");
}
function draw() {
background(255);
// print frq
noStroke();
// print words in back randomly
for (let i = 0; i < 20; i++) {
bfrq = random(frq);
badj = random(adj);
bnoun = random(nounspl);
bverb = random(verb);
badv = random(adv);
bplace = random(place);
fill(168)
textSize(sz/2);
textStyle(NORMAL)
text(bfrq,random(width),random(height))
text(badj,random(width),random(height))
text(bnoun,random(width),random(height))
textStyle(ITALIC)
text(bverb,random(width),random(height))
text(badv,random(width),random(height))
text(bplace,random(width),random(height))
}
fill(0);
if (frameCount % 25 == 0) {
mfrq = random(frq);
madj = random(adj);
mnoun = random(nounspl);
mverb = random(verb);
madv = random(adv);
mplace = random(place);
}
textSize(sz);
textStyle(BOLD)
text(mfrq, width / 2, sz + off);
text(madj, width / 2, sz * 2 + off);
text(mnoun, width / 2, sz * 3 + off);
text(mverb, width / 2, sz * 4 + off);
text(madv, width / 2, sz * 5 + off);
text(mplace, width / 2, sz * 6 + off);
}
function keyPressed() {
// this will download the first 25 seconds of the animation!
if (key === 'g') {
saveGif('poet.gif', 25);
}
if (key === 's') {
saveCanvas('poet', 'jpg');
}
}