🎮ArcadeLab

神秘礼盒 - 拆礼物小游戏

by GlitchNinja54
194 lines5.4 KB
▶ Play
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>神秘礼盒 - 拆礼物小游戏</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            color: #fff;
            overflow: hidden;
        }

        .game-container {
            text-align: center;
            background: rgba(255, 255, 255, 0.05);
            padding: 40px;
            border-radius: 20px;
            backdrop-filter: blur(10px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            max-width: 400px;
            width: 100%;
        }

        h1 {
            font-size: 24px;
            margin-bottom: 10px;
            color: #ffd700;
        }

        p {
            font-size: 16px;
            color: #ccc;
            margin-bottom: 30px;
        }

        /* Kotak Hadiah */
        .gift-box {
            position: relative;
            width: 150px;
            height: 150px;
            margin: 0 auto 30px;
            cursor: pointer;
            transition: transform 0.3s ease;
        }

        .gift-box:hover {
            transform: scale(1.05);
        }

        .box-body {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 120px;
            background: #e94560;
            border-radius: 0 0 10px 10px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }

        .box-lid {
            position: absolute;
            top: 0;
            left: -5px;
            width: 160px;
            height: 40px;
            background: #ff6b6b;
            border-radius: 5px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.2);
            transition: transform 0.5s ease, top 0.5s ease;
        }

        /* Pita Hadiah */
        .ribbon-vertical {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 25px;
            background: #ffd700;
        }

        .ribbon-horizontal {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 100%;
            height: 25px;
            background: #ffd700;
        }

        /* Animasi saat dibuka */
        .gift-box.opened .box-lid {
            transform: translateY(-60px) rotate(-15deg);
            opacity: 0;
        }

        /* Hadiah di Dalam */
        .prize {
            display: none;
            font-size: 20px;
            font-weight: bold;
            color: #4ecc6d;
            margin-top: 20px;
            animation: fadeIn 1s ease forwards;
        }

        .btn-reset {
            display: none;
            margin: 20px auto 0;
            padding: 10px 20px;
            background-color: #0f3460;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: background 0.2s;
        }

        .btn-reset:hover {
            background-color: #e94560;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body>

    <div class="game-container">
        <h1>神秘礼盒</h1>
        <p>点击下方的礼盒来开启你的惊喜!</p>
        
        <!-- Elemen Kotak Hadiah -->
        <div class="gift-box" id="giftBox" onclick="openGift()">
            <div class="box-lid">
                <div class="ribbon-vertical"></div>
            </div>
            <div class="box-body">
                <div class="ribbon-vertical"></div>
                <div class="ribbon-horizontal"></div>
            </div>
        </div>

        <!-- Pesan Hadiah -->
        <div class="prize" id="prizeText">🎉 恭喜你!获得了一份神秘大奖:一万元现金! 🎉</div>
        
        <!-- Tombol Main Lagi -->
        <button class="btn-reset" id="resetBtn" onclick="resetGame()">再玩一次</button>
    </div>

    <script>
        function openGift() {
            const giftBox = document.getElementById('giftBox');
            const prizeText = document.getElementById('prizeText');
            const resetBtn = document.getElementById('resetBtn');

            // Tambahkan kelas animasi buka
            giftBox.classList.add('opened');
            giftBox.style.pointerEvents = 'none'; // Mencegah klik berulang

            // Tampilkan hadiah dan tombol reset setelah animasi selesai
            setTimeout(() => {
                prizeText.style.display = 'block';
                resetBtn.style.display = 'block';
            }, 500);
        }

        function resetGame() {
            const giftBox = document.getElementById('giftBox');
            const prizeText = document.getElementById('prizeText');
            const resetBtn = document.getElementById('resetBtn');

            // Kembalikan ke keadaan semula
            giftBox.classList.remove('opened');
            giftBox.style.pointerEvents = 'auto';
            prizeText.style.display = 'none';
            resetBtn.style.display = 'none';
        }
    </script>

</body>
</html>

Game Source: 神秘礼盒 - 拆礼物小游戏

Creator: GlitchNinja54

Libraries: none

Complexity: moderate (194 lines, 5.4 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: game-glitchninja54" to link back to the original. Then publish at arcadelab.ai/publish.