xxxxxxxxxx
54
/* HELPFUL LINKS
https://creative-coding.decontextualize.com/arrays-and-objects/
https://creative-coding.decontextualize.com/text-and-type/
*/
poetry = [];
let lyricsSrc = "I am finetuning my soul, to the universal wavelength, no one is a lover alone, I propose an atom dance, Our hearts are coral reefs in low tide, Love is the ocean we crave restlessly, turning around and around, I am dancing towards transformation, Learning by love to open it up, Let this ugly wound breathe, We fear unconditional heart space, Healed by atom dance, When you feel the flow as primal love, Enter the pain and dance with me, We aim at peeling off, Dead layers of loveless love";
var lyrics = lyricsSrc.split(",");
function setup() {
createCanvas(windowWidth, windowHeight);
//createCanvas(600, 400);
}
function draw() {
background(0);
for (i = 0; i < poetry.length; i++) {
poetry[i].display();
}
}
function mousePressed() {
//https://www.kirupa.com/html5/picking_random_item_from_array.htm
var lyricTest = lyrics[Math.floor(Math.random() * lyrics.length)];
print("test: ", lyricTest);
for (i = 0; i < lyrics.length; i++){
textSize(20);
textFont('Courier');
fill(random(255), 0, random(0, 100), 250);
let w = new Word(lyricTest, mouseX, mouseY, random(255));
poetry.push(w);
}
}
class Word{
constructor(n, x, y, r, g, b){
this.x = x;
this.y = y;
this.name = n;
}
display (){
text(this.name, this.x, this.y);
background(0, 0, 0, 40)
}
}