xxxxxxxxxx
378
let currentScene = 0;
let scenes;
let generatedText;
function setup() {
createCanvas(400, 400);
//iterating through the scenes via an array
scenes = [theLovers, HusbandAndWife, TheSisters];
generateText(); //generates dynamic text at the start
}
function draw() {
background("#E0C9A6");
// Display dynamic generative text
textFont("Times New Roman");
fill("#352100");
text(generatedText, 5, 15, 390, 380);
scenes[currentScene]();
}
//generating the text
function generateText() {
let openings = [
"'Oh gosh, is that the time? Sorry, I have to go,' I mumbled evasively.",
"'I didn't expect this conversation to go this way,' you admitted hesitantly.",
"'Are you really leaving?' I asked, my voice barely above a whisper."
];
let middles = [
"You looked at him with uncertainty. The clocks in the café all showed different times, adding to the confusion.",
"My fingers absentmindedly traced the rim of my 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?' you finally asked, breaking the silence.",
"I sighed, glancing at my watch, knowing there was no easy answer.",
"Without another word, I stood up and walked toward the exit, leaving you behind."
];
// Construct generative text
generatedText = random(openings) + "\n\n" + random(middles) + "\n\n" + random(endings);
}
//making the first scene
function theLovers(){
//making the silhouettes
fill("#352100");
noStroke();
//heads
circle(161,130,80);
circle(212,174,80);
//bodies
quad(214,154,80,179,104,373,203,373);
quad(167,205,277,189,320,365,236,359);
quad(122,133,130,174,177,173,167,130);
arc(121,137,10,20,PI*2,0);
circle(84,210,60);
//arms
push();
angleMode(DEGREES);
translate(70,280);
rotate(3);
ellipse(0,0,45,200);
pop();
push();
angleMode(DEGREES);
translate(45,370);
rotate(3);
ellipse(0,0,60,25);
pop();
push();
angleMode(DEGREES);
translate(152,369);
rotate(3);
ellipse(0,0,100,50);
pop();
push();
angleMode(DEGREES);
translate(85,340);
rotate(30);
ellipse(0,0,150,55);
pop();
push();
angleMode(DEGREES);
translate(220,340);
rotate(330);
ellipse(0,0,150,55);
pop();
push();
angleMode(DEGREES);
translate(310,253);
rotate(55);
ellipse(0,0,150,40);
pop();
push();
angleMode(DEGREES);
translate(290,334);
rotate(145);
ellipse(0,0,150,55);
pop();
push();
angleMode(DEGREES);
translate(300,355);
rotate(30);
ellipse(0,0,80,40);
pop();
//text
push();
fill("#E0C9A6")
textSize(35)
textStyle(ITALIC);
textFont("Times New Roman");
text("The Lovers",107,262)
pop();
}
//making the second scene
function HusbandAndWife(){
//heads
fill("#352100");
noStroke();
circle(143,106,60);
circle(278,75,60);
//body
quad(116,118,168,118,169,358,116,358);
quad(114,103,104,134,187,114,168,95);
quad(119,144,90,160,74,237,118,258);
quad(100,248,86,318,131,347,117,256);
quad(101,322,110,400,172,399,167,344);
quad(168,144,193,156,213,212,167,248);
quad(190,227,203,314,168,359,168,238);
quad(200,313,196,400,167,400,161,357);
push();
angleMode(DEGREES);
translate(88,244);
ellipse(0,0,30,20);
pop();
push();
angleMode(DEGREES);
translate(85,205);
rotate(100);
ellipse(0,0,85,20);
pop();
push();
angleMode(DEGREES);
translate(200,220);
rotate(345);
ellipse(0,0,30,55);
pop();
quad(248,74,229,76,226,84,272,103);
quad(275,102,312,120,314,110,297,90);
quad(252,92,250,312,280,314,301,80);
quad(255,114,232,116,212,218,254,240);
quad(210,216,211,244,220,251,230,226);
quad(251,237,236,279,238,308,250,310);
quad(242,280,241,400,273,400,277,282);
quad(295,120,335,134,354,238,282,239);
quad(272,303,339,293,349,235,284,234);
quad(288,298,273,396,270,311,280,295);
quad(294,296,297,362,328,366,334,289);
quad(296,360,293,400,324,400,327,363);
quad(218,247,200,400,193,400,213,246);
push();
angleMode(DEGREES);
translate(223,170);
rotate(100);
ellipse(0,0,100,35);
pop();
push();
angleMode(DEGREES);
translate(213,254);
rotate(55);
ellipse(0,0,30,20);
pop();
quad(229,225,238,267,255,270,246,224);
push();
angleMode(DEGREES);
translate(342,185);
rotate(85);
ellipse(0,0,100,20);
pop();
//text
push();
fill("#E0C9A6")
textSize(35)
textStyle(ITALIC);
textFont("Times New Roman");
text("Husband and Wife",80,210)
pop();
}
function TheSisters(){
//heads
fill("#352100");
noStroke();
circle(134,160,60);
circle(270,148,60);
//body
quad(114,173,88,322,188,297,151,176);
quad(147,178,198,206,194,218,154,204);
quad(115,182,90,200,94,214,110,212);
quad(106,312,112,358,125,358,134,306);
quad(139,305,147,338,157,335,156,294);
quad(94,212,70,242,62,241,88,200);
push();
angleMode(DEGREES);
translate(115,355);
rotate(115);
ellipse(0,0,25,15);
pop();
push();
angleMode(DEGREES);
translate(152,348);
rotate(105);
ellipse(0,0,35,15);
pop();
push();
angleMode(DEGREES);
translate(95,273);
rotate(100);
ellipse(0,0,100,15);
pop();
push();
angleMode(DEGREES);
translate(135,306);
rotate(165);
ellipse(0,0,110,35);
pop();
push();
angleMode(DEGREES);
translate(101,195);
rotate(145);
ellipse(0,0,45,15);
pop();
quad(106,149,79,157,100,179,112,181);
push();
angleMode(DEGREES);
translate(173,208);
rotate(25);
ellipse(0,0,25,15);
pop();
push();
angleMode(DEGREES);
translate(64,250);
rotate(115);
ellipse(0,0,25,15);
pop();
push();
angleMode(DEGREES);
translate(235,204);
rotate(25);
ellipse(0,0,35,25);
pop();
push();
angleMode(DEGREES);
translate(257,160);
rotate(45);
ellipse(0,0,30,55);
pop();
circle(190,218,30);
push();
angleMode(DEGREES);
translate(290,160);
rotate(345);
ellipse(0,0,30,55);
pop();
push();
angleMode(DEGREES);
translate(233,262);
rotate(115);
ellipse(0,0,80,15);
pop();
push();
angleMode(DEGREES);
translate(233,295);
rotate(45);
ellipse(0,0,35,15);
pop();
push();
angleMode(DEGREES);
translate(245,348);
rotate(120);
ellipse(0,0,25,15);
pop();
push();
angleMode(DEGREES);
translate(278,327);
rotate(115);
ellipse(0,0,25,15);
pop();
push();
angleMode(DEGREES);
translate(302,274);
rotate(75);
ellipse(0,0,100,15);
pop();
push();
angleMode(DEGREES);
translate(340,248);
rotate(115);
ellipse(0,0,25,15);
pop();
quad(256,171,224,294,313,322,283,160);
quad(190,212,192,225,250,210,254,190);
quad(234,206,242,230,256,224,248,202);
quad(278,177,318,200,304,222,288,223);
quad(304,216,337,250,348,247,313,200);
quad(243,292,248,339,255,340,264,301);
quad(276,310,276,322,285,321,291,303);
circle(205,196,40)
//text
push();
fill("#E0C9A6")
textSize(35)
textStyle(ITALIC);
textFont("Times New Roman");
text("The Sisters",120,210)
pop();
}
//using this to track the position of shapes
function mouseClicked(){
console.log(mouseX, mouseY)
//Change scene on mouse press
currentScene = (currentScene + 1) % scenes.length;
}