File size: 2,522 Bytes
3ff9928
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// 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;