let nameInput, surnameInput, submitButton;
let welcomeBg, invitationBg, decoration1, decoration2, reindeerImg;
let lightsBlinking = true;
welcomeBg = loadImage('bg.jpg');
invitationBg = loadImage('bg2.jpg');
decoration1 = loadImage('festive1.jpg');
decoration2 = loadImage('festive2.jpg');
reindeerImg = loadImage('reindeer.jpg');
christmasTune = loadSound('christmas-holidays-270797.mp3');
nameInput = createInput();
nameInput.position(750, 60);
nameInput.attribute('placeholder', 'Enter your Name');
surnameInput = createInput();
surnameInput.position(750, 90);
surnameInput.attribute('placeholder', 'Enter your Surname');
submitButton = createButton('Open Invitation');
submitButton.position(780, 120);
submitButton.mousePressed(openInvitation);
for (let i = 0; i < 100; i++) {
snowflakes.push(new Snowflake());
for (let i = 50; i <= width - 50; i += 100) {
fairyLights.push(new FairyLight(i, 50));
function drawGreeting() {
text("Welcome because YOU are SpEciAl ;p", width / 2, 200);
function openInvitation() {
userName = nameInput.value() + " " + surnameInput.value();
if (userName.trim() !== "") {
function drawInvitationCard() {
background(invitationBg);
image(decoration1, 50, 100, 150, 150);
image(decoration2, width - 200, 100, 150, 150);
text("Merry Christmas!", width / 2, 275);
text(`Dear ${userName},`, width / 2, 310);
text("You are warmly invited to celebrate with me BESTIE;)", width / 2, 340);
for (let flake of snowflakes) {
for (let light of fairyLights) {
image(reindeerImg, width / 2 - 75, 450, 150, 150);
lightsBlinking = !lightsBlinking;
function mousePressed() {
if (mouseX >= width / 2 - 75 && mouseX <= width / 2 + 75 &&
mouseY >= 450 && mouseY <= 600) {
if (!christmasTune.isPlaying()) {
this.y = random(-height, 0);
this.size = random(3, 7);
this.speed = random(0.5, 1.5);
this.y = random(-height, 0);
fill(255, 255, 255, 200);
ellipse(this.x, this.y, this.size, this.size);
this.on = frameCount % 60 < 30;
fill(this.on ? color(255, 223, 0) : color(100, 100, 100));
ellipse(this.x, this.y, 20, 20);