three实现三维跷跷板游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维跷跷板游戏代码,点击跷跷板两侧放置砝码,保持平衡!让跷跷板倾斜角度最小,得分最高! 收集特殊砝码获得额外分数!

代码标签: three 三维 跷跷板 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D跷跷板游戏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
            font-family: 'Arial', sans-serif;
            overflow: hidden;
            height: 100vh;
        }
        #canvas {
            display: block;
            cursor: pointer;
        }
        #ui {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 30px;
            align-items: center;
            background: rgba(255,255,255,0.1);
            backdrop-filter: blur(10px);
            padding: 15px 30px;
            border-radius: 50px;
            border: 1px solid rgba(255,255,255,0.2);
            z-index: 100;
        }
        .score-box {
            text-align: center;
            color: white;
        }
        .score-label {
            font-size: 12px;
            opacity: 0.7;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        .score-value {
            font-size: 28px;
            font-weight: bold;
            color: #ffd700;
        }
        #timer {
            font-size: 24px;
            color: #ff6b6b;
            font-weight: bold;
            min-width: 60px;
            text-align: center;
        }
        #balance-bar {
            position: fixed;
            top: 100px;
            left: 50%;
            transform: translateX(-50%);
            width: 300px;
            background: rgba(255,255,255,0.1);
            border-radius: 10px;
            height: 12px;
            border: 1px solid rgba(255,255,255,0.3);
            overflow: hidden;
        }
        #balance-indicator {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 100%;
            background: #ffd700;
            border-radius: 10px;
            transition: left 0.1s;
        }
        #balance-left, #balance-right {
            position: absolute;
            top: 0;
            height: 100%;
            border-radius: 10px;
        }
        #balance-left {
            left: 0;
            background: linear-gradient(to right, #ff4757, #ff6b81);
        }
        #balance-right {
            right: 0;
            background: linear-gradient(to left, #ff4757, #ff6b81);
        }
        #message {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 48px;
            font-weight: bold;
            text-align: center;
            text-shadow: 0 0 30px rgba(255,215,0,0.8);
            display: none;
            z-index: 200;
            animation: pulse 0.5s ease-in-out infinite alternate;
        }
        @keyframes pulse {
            from { transform: translate(-50%, -50%) scale(1); }
            to { transform: translate(-50%, -50%) scale(1.05); }
        }
        #start-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(15,52,96,0.95));
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 300;
        }
        #start-screen h1 {
            color: #ffd700;
            font-size: 56px;
            margin-bottom: 20px;
            text-shadow: 0 0 30px rgba(255,215,0,0.5);
            animation: glow 2s ease-in-out infinite alternate;
        }
        @keyframes glow {
            from { text-shadow: 0 0 20px rgba(255,215,0,0.5); }
            to { text-shadow: 0 0 40px rgba(255,215,0,1), 0 0 80px rgba(255,215,0,0.5); }
        }
        #start-screen p {
            color: rgba(255,255,255,0.8);
            font-size: 18px;
            margin-bottom: 10px;
            text-align: center;
           .........完整代码请登录后点击上方下载按钮下载查看

网友评论0