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>手动挡驾驶模拟器 | Sequential Shifter</title>
<link href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet">
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  
  :root {
    --bg: #0a0e1a;
    --bg-2: #141822;
    --fg: #e8eef5;
    --muted: #6b7689;
    --accent: #ffaa00;
    --accent-2: #ff6600;
    --danger: #ff3344;
    --success: #44ff88;
    --info: #44ddff;
    --border: rgba(255,170,0,0.25);
  }
  
  html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
  }
  
  #scene {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
  }
  
  #hud {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
  }
  
  /* 顶部信息栏 */
  .top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
  }
  
  .title-block {
    background: rgba(10,14,26,0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 12px 22px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  }
  
  .title {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--accent);
    line-height: 1.2;
  }
  
  .subtitle {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 2px;
    margin-top: 3px;
    text-transform: uppercase;
  }
  
  .status-indicators {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  
  .indicator {
    background: rgba(10,14,26,0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 8px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    transition: all 0.2s;
  }
  
  .indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #444;
    transition: all 0.2s;
  }
  
  .indicator.active { 
    border-color: rgba(68,255,136,0.4);
    background: rgba(68,255,136,0.1);
  }
  .indicator.active .dot { 
    background: var(--success); 
    box-shadow: 0 0 12px var(--success); 
  }
  .indicator.warn { border-color: rgba(255,170,0,0.4); }
  .indicator.warn .dot { 
    background: var(--accent); 
    box-shadow: 0 0 12px var(--accent); 
  }
  .indicator.danger { 
    border-color: rgba(255,51,68,0.5);
    background: rgba(255,51,68,0.1);
  }
  .indicator.danger .dot { 
    background: var(--danger); 
    box-shadow: 0 0 12px var(--danger); 
    animation: pulse 0.5s infinite alternate;
  }
  
  @keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.3); }
  }
  
  /* 仪表盘 */
  .dashboard {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(180deg, rgba(20,24,34,0.92), rgba(10,14,26,0.96));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,170,0,0.3);
    border-radius: 18px;
    padding: 22px 30px;
    box-shadow: 
      0 -10px 50px rgba(0,0,0,0.6), 
      0 0 40px rgba(255,170,0,0.12),
      inset 0 1px 0 rgba(255,255,255,0.05);
  }
  
  .gauge {
    width: 180px;
    height: 180px;
    position: relative;
  }
  
  .gauge svg {
    width: 100%;
    height: 100%;
    overflow: visible;
  }
  
  .gauge-value {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
  }
  
  .gauge-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--fg);
    line-height: 1;
    text-shadow: 0 0 12px rgba(255,255,255,0.3);
  }
  
  .gauge-unit {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 3px;
    margin-top: 4px;
    font-weight: 600;
  }
  
  /* 推拉式换挡面板 */
  .gear-panel {
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
  }
  
  .gear-label {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 4px;
    font-weight: 700;
  }
  
  .shifter-base {
    position: relative;
    width: 50px;
    height: 220px;
    background: radial-gradient(circle at 50% 50%, #1a1f2a, #0a0e14);
    border-radius: 25px;
    border: 2px solid #2a3040;
    box-shadow: 
      0 5px 20px rgba(0,0,0,0.6),
      inset 0 2px 4px rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
  }
  
  .shifter-track {
    width: 14px;
    height: 190px;
    margin-top: 15px;
    background: #000;
    border-radius: 7px;
    position: relative;
    box-shadow: inset 0 0 6px rgba(0,0,0,1);
  }
  
  .shifter-knob {
    position: absolute;
    left: 50%;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 35% 30%, #ffffff, #999 30%, #444 100%);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 
      0 4px 10px rgba(0,0,0,0.8), 
      inset 0 2px 4px rgba(255,255,255,0.5),
      inset 0 -3px 6px rgba(0,0,0,0.4);
    cursor: grab;
    z-index: 2;
    top: calc(.........完整代码请登录后点击上方下载按钮下载查看

网友评论0