/*Valentines Day is a day for love. In this project everytime you refresh there would be a different coloured heart. Those colours are pink, blue, purple, yellow, green, red, and orange. The heart colours match with the background colours. Sometimes there will be a card with a flower made of hearts. When you click the screen you will be asked for your name. Your name would be part of the message. When you click again, you will be shown what's inside the card. There are three different hearts that would appear each time on the left side of the heart. On the right side there would be a message. Each time there would be a different adjective inside in the message. Happy Valentine's Day! */ //pink, blue, purple, yellow, green, red, orange var back = [ color(255, 219, 243), color(217, 234, 250), color(234, 205, 247), color(242, 242, 201), color(208, 247, 205), color(245, 184, 195), color(247, 222, 181)]; var heartCol = [ color(247, 114, 174), color(115, 203, 250), color(189, 110, 245), color(242, 245, 105), color(109, 252, 118), color(252, 25, 0), color(247, 136, 25)]; var heartCol2 = [ color(255, 143, 203), color(161, 230, 255), color(210, 143, 255), color(255, 253, 156), color(166, 255, 163), color(255, 79, 79), color(247, 160, 67)]; var heartCol3 = [ color(250, 165, 216), color(184, 236, 255), color(227, 161, 255), color(251, 255, 181), color(191, 255, 184), color(255, 114, 107), color(255, 193, 94)]; var heartCol4 = [ color(247, 183, 222), color(204, 241, 255), color(235, 189, 255), color(247, 250, 197), color(221, 255, 217), color(252, 154, 149), color(252, 207, 134)]; var heartCol5 = [ color(255, 219, 241), color(227, 247, 255), color(239, 215, 250), color(254, 255, 230), color(234, 255, 232), color(255, 185, 181), color(252, 227, 187)]; var messages = [ "\nlovely", "\nhappy", "\nwonderful", "\njoyful", "\npeaceful", "n\nexciting", "n\nexcellent", "\nterrific", "n\namazing", "\ncheerful", "\ngreat", "\ngood"]; var image1 = getImage("space/healthheart"); var image2 = getImage("minecraft/heart"); var image3 = getImage("cute/Heart"); var images = [ image1, image2, image3]; var courierNew = createFont("Courier New"); var names = ""; var showing = false; if(random(0, 100) < 33){ showing = true; } else if(random(0, 100) < 50){ showing = true; } var heart = function(){ var heartChoice = round(random(0, back.length - 1)); background(back[heartChoice]); translate(-109, -140); scale(1.6); fill(heartCol[heartChoice]); noStroke(); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(heartCol2[heartChoice]); translate(39.2, 42.5); scale(0.8); noStroke(); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(heartCol3[heartChoice]); translate(39.2, 42.5); scale(0.8); noStroke(); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(heartCol4[heartChoice]); translate(39.2, 42.5); scale(0.8); noStroke(); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(heartCol5[heartChoice]); translate(39.2, 42.5); scale(0.8); noStroke(); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); resetMatrix(); }; var frontCard = function(){ resetMatrix(); background(back[round(random(0, back.length - 1))]); fill(255); rectMode(CENTER); noStroke(); rect(200, 200, 200, 300); fill(240, 58, 94); textFont(!courierNew); textSize(25); textAlign(CENTER, CENTER); text("Happy\nValentine's\nDay "+names, 200, 100); text("click on the screen "+names+"\nthen click again", 200, 375); fill(240, 62, 98); translate(140, 128); scale(0.3); ellipse(169, 175, 110, 110); ellipse(265, 175, 110, 110); triangle(100, 205, 315, 205, 205, 316); ellipse(191, 200, 20, 20); fill(247, 121, 161); translate(-180, 296); rotate(-55); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(240, 62, 98); translate(-180, 296); rotate(-55); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(247, 121, 161); translate(-180, 296); rotate(-55); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(240, 62, 98); translate(-180, 296); rotate(-55); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); fill(247, 121, 161); translate(-180, 296); rotate(-55); ellipse(145, 175, 110, 110); ellipse(245, 175, 110, 110); triangle(98, 205, 291, 205, 200, 316); ellipse(191, 200, 20, 20); resetMatrix(); fill(247, 247, 190); ellipse(199, 224, 25, 25); }; var backCard = function(){ resetMatrix(); background(back[round(random(0, back.length - 1))]); stroke(0); fill(255); quad(200, 75, 200, 375, 45, 285, 45, 5); quad(200, 75, 200, 375, 355, 285, 355, 5); rotate(-19); fill(0); textSize(70); textFont(courierNew, 20); text("I hope you\nhave a"+messages[round(random(0, messages.length - 1))]+" \nValentine's\nDay\n\n\n\nxoxo", 225, 245); resetMatrix(); imageMode(CENTER); image(images[round(random(0, images.length - 1))], 122, 175, 100, 110); }; if(showing){ heart(); } else{ frontCard(); } var mouseClicked = function(){ if(!showing){ if(mouseX > 0 && mouseY > 0&& names !== ""){ backCard(); } else{ names = prompt("Write your name", "Carl"); frontCard(); } } };