xxxxxxxxxx
130
let wood;
let greatVibes;
let quintessential;
//Preloads the fonts and wood image
function preload() {
wood = loadImage('wood.jpg');
greatVibes = loadFont('GreatVibes-Regular.ttf');
quintessential = loadFont('Quintessential-Regular.ttf');
}
function setup() {
createCanvas(600, 400);
noLoop();
}
function draw() {
drawMuseum();
drawLights();
drawFrame();
createPoem();
drawTitle();
}
//creates the title at the top
function drawTitle() {
fill('#62463D');
textSize(50);
textAlign(CENTER, TOP);
textFont(greatVibes);
text("The Museum of Poems", width / 2 - 6, 25);
}
//Creates the entire background and floor of the museum
function drawMuseum() {
//Draws the gradient background
for (let i = 0; i <= height - 100; i++) {
let inter = map(i, 0, height - 100, 0, 1);
let wallColor = lerpColor(color('#ECC2EC'), color('#DCB5A5'), inter);
stroke(wallColor);
line(0, i, width, i);
}
// Creates the wood texture on the floor
for (let i = 0; i < width + 50; i += 100) {
// Draw the first set of wood planks
image(wood, i, height - 100, 100, 50);
image(wood, i - 50, height - 50, 100, 50);
// Adds borders around each plank
stroke('#BC7C64');
noFill();
rect(i, height - 100, 100, 50);
rect(i - 50, height - 50, 100, 50);
}
}
//draws the sconces on the sides of the frame
function drawLights() {
fill('#695750');
rect(80, 180, 20, 40, 5);
rect(500, 180, 20, 40, 5);
// draws the sconce's arms
stroke('#9E7566');
strokeWeight(3);
line(90, 200, 70, 180);
line(90, 200, 110, 180);
line(510, 200, 490, 180);
line(510, 200, 530, 180);
noStroke();
// draws the light bulbs
fill('#F8C429');
ellipse(70, 175, 15, 20);
ellipse(110, 175, 15, 20);
ellipse(490, 175, 15, 20);
ellipse(530, 175, 15, 20);
// creates the glow effect on the light bulbs
fill('rgba(243,232,178,0.44)');
ellipse(70, 175, 30, 40);
ellipse(110, 175, 30, 40);
ellipse(490, 175, 30, 40);
ellipse(530, 175, 30, 40);
}
//draws the frame for the poetry
function drawFrame() {
fill('#DAA520');
rect(170, 100, 260, 160, 15);
fill('#FFD700');
rect(185, 115, 230, 130, 10);
fill('#FFFAF0');
rect(195, 125, 210, 110);
fill('#B4781E');
ellipse(175, 105, 20, 20);
ellipse(425, 105, 20, 20);
ellipse(175, 255, 20, 20);
ellipse(425, 255, 20, 20);
}
// generates a randomly selected poem from the list in the frame
function createPoem() {
let poems = [
"“And I want the world to understand me, but how could I explain that by ‘my world,’ I meant only you?”",
"“A child’s laughter echoes like music, awakening a part of us we forget exists.”",
"“A stranger’s laughter drifts through the air, proof that joy exists even when you’re not looking.”",
"“Every breath is a quiet miracle, a reminder that life is happening within you.”",
"“Somewhere, a flower blooms without being seen, and still, it chooses to be beautiful.”",
"“Time moves forward, unaware of us, but we carry its weight like an old coat.”",
"“You will never be as young as you are now, yet you waste time as if it belongs to you.”",
"“In your silence, I hear the depth of your thoughts, a language only my heart understands.”",
"“I trace the lines of your face, and in the silence, I find a lifetime of conversations.”",
"“Life doesn’t need to be perfect to be beautiful, sometimes it’s the cracks that let the light in.”",
"“To love is not to possess, but to let someone else be exactly who they are.”",
"“In the way they met, there was no beginning, just a quiet unfolding, like petals opening in the dark.”",
];
let poem = random(poems);
fill('#502814');
textSize(16);
textAlign(CENTER, CENTER);
textFont(quintessential);
text(poem, 195, 135, 210, 85);
}