xxxxxxxxxx
47
let img;
let displayRect = false;
function preload() {
img = loadImage('nowords.jpg');
}
function setup() {
createCanvas(windowWidth, windowHeight);
textAlign(CENTER)
textSize(24)
}
function draw() {
background(220);
image(img, (windowWidth - img.width)/2, (windowHeight-img.height)/2)
let text1 = 'I may not always say it\n but I love you very much\n and appreciate you.'
let text2 = 'Thank you for being \nthe best wife to me and \nthe best mother to our daughter.'
fill(181, 26, 58)
text(text1, 0, (windowHeight-600)/2, (windowWidth - img.width)/2, windowHeight)
text(text2, 0, (windowHeight-300)/2, (windowWidth - img.width)/2, windowHeight)
text("Happy Valentine's Day!\n\n Love,\n\n Dan", 0, windowHeight-350, (windowWidth - img.width)/2, windowHeight)
if (displayRect) {
fill('pink')
rect(0, 0, windowWidth, windowHeight)
fill(181, 26, 58)
text('Unlimited free massages a la Dan :)', windowWidth/2-100, windowHeight/2-100)
} else {
noFill()
rect(10, windowHeight-125, (windowWidth-img.width)/2-25, windowHeight-100)
fill(181, 26, 58)
text('Click anywhere to reveal your present', 0, (windowHeight-100), (windowWidth - img.width)/2, windowHeight)
}
}
function mousePressed() {
if (!displayRect) {
displayRect = true;
} else {
displayRect = false;
}
}