Spaces:
Running
Running
| // Data Arrays - Filenames must match your folder exactly | |
| const photos = ["sys_asset_01.jpeg", "sys_asset_02.jpeg"]; | |
| const messages = [ | |
| "Hey Eesha ✨", | |
| "You’re something special.", | |
| "Every memory hits different.", | |
| "Pure vibes only.", | |
| "You’re irreplaceable.", | |
| "Ready for our world?" | |
| ]; | |
| let currentPhotoIdx = 0, lineIdx = 0, charIdx = 0; | |
| // Security: Disable right-click | |
| document.addEventListener('contextmenu', event => event.preventDefault()); | |
| function typeWriter() { | |
| const terminal = document.getElementById("typewriter"); | |
| if (lineIdx < messages.length) { | |
| if (charIdx === 0) terminal.innerHTML += "> "; | |
| if (charIdx < messages[lineIdx].length) { | |
| terminal.innerHTML += messages[lineIdx].charAt(charIdx); | |
| charIdx++; | |
| setTimeout(typeWriter, 40); | |
| } else { | |
| terminal.innerHTML += "<br>"; | |
| lineIdx++; charIdx = 0; setTimeout(typeWriter, 600); | |
| } | |
| } else { | |
| document.getElementById("start-btn").classList.remove("hidden"); | |
| } | |
| } | |
| function changePhoto() { | |
| currentPhotoIdx = (currentPhotoIdx + 1) % photos.length; | |
| document.getElementById("main-photo").src = photos[currentPhotoIdx]; | |
| } | |
| function nextSection(id) { | |
| document.querySelectorAll('.page').forEach(p => p.classList.add('hidden')); | |
| document.getElementById(id).classList.remove('hidden'); | |
| if(id === 'game') moveTarget(); | |
| } | |
| let score = 0; | |
| function catchKitty() { | |
| score++; | |
| document.getElementById("count").innerText = score; | |
| if (score >= 10) nextSection('gallery'); | |
| else moveTarget(); | |
| } | |
| function moveTarget() { | |
| const target = document.getElementById("target"); | |
| target.style.left = Math.random() * 240 + "px"; | |
| target.style.top = Math.random() * 190 + "px"; | |
| } | |
| function cutCake() { | |
| const knife = document.getElementById('knife'); | |
| knife.style.opacity = "1"; | |
| knife.style.top = "20px"; | |
| setTimeout(() => { | |
| document.getElementById('cake-left').style.transform = "translateX(-35px) rotate(-10deg)"; | |
| document.getElementById('cake-right').style.transform = "translateX(35px) rotate(10deg)"; | |
| document.getElementById('cake-msg').innerText = "Perfectly cut for Eesha! 🍰"; | |
| document.getElementById('final-btn').classList.remove('hidden'); | |
| knife.style.opacity = "0"; | |
| }, 500); | |
| } | |
| // CRITICAL: Starts the animation when the window loads | |
| window.onload = typeWriter; |