three实现三维驾驶高铁停靠站点上下客代码

代码语言:html

所属分类:其他

代码由gemini-4-hydrogen ai生成,可能有错误,仅供参考:点击查看提示词

代码描述: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 驾驶仿真 - Three.js</title>
<style>
  * { box-sizing: border-box; user-select: none; }
  html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
    overflow: hidden; background: #1a2a3a;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #fff;
  }
  #canvas-container { width: 100%; height: 100%; position: relative; }

  /* 顶部信息栏 */
  .hud-top {
    position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 18px; align-items: center;
    background: rgba(10, 20, 35, 0.72);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(100, 190, 255, 0.35);
    padding: 10px 22px; border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    z-index: 10;
  }
  .hud-item { text-align: center; min-width: 95px; }
  .hud-label { font-size: 11px; color: #8ecae6; letter-spacing: 1px; }
  .hud-val { font-size: 20px; font-weight: bold; color: #ffffff; margin-top: 2px; }
  .hud-val.highlight { color: #ffd166; }
  .hud-val.green { color: #06d6a0; }
  .hud-divider { width: 1px; height: 32px; background: rgba(255,255,255,0.18); }

  /* 状态提示条 */
  #alert-banner {
    position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 119, 182, 0.85);
    border: 1px solid #90e0ef;
    padding: 8px 22px; border-radius: 24px;
    font-size: 15px; font-weight: 500;
    z-index: 10; transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    white-space: nowrap;
  }
  #alert-banner.warning { background: rgba(217, 119, 6, 0.9); border-color: #fde68a; }
  #alert-banner.station { background: rgba(5, 150, 105, 0.9); border-color: #6ee7b7; }

  /* 底部控制面板 */
  .hud-bottom {
    position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 14px; align-items: flex-end;
    z-index: 10; flex-wrap: wrap; justify-content: center;
    width: 95%; max-width: 960px;
  }
  .panel-box {
    background: rgba(10, 20, 35, 0.78);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(100, 190, 255, 0.3);
    border-radius: 12px; padding: 12px 16px;
    display: flex; gap: 10px; align-items: center;
  }

  /* 速度表盘 */
  .speedometer {
    display: flex; flex-direction: column; align-items: center; min-width: 110px;
  }
  .speed-num {
    font-size: 36px; font-weight: 800; line-height: 1;
    color: #00f5d4; font-variant-numeric: tabular-nums;
  }
  .speed-unit { font-size: 12px; color: #90e0ef; margin-top: 2px; }
  .throttle-bar-wrap {
    width: 100%; height: 6px; background: rgba(255,255,255,0.15);
    border-radius: 3px; margin-top: 8px; overflow: hidden;
  }
  #speed-bar {
    height: 100%; width: 0%; background: linear-gradient(90deg, #06d6a0, #ffd166, #ef476f);
    transition: width 0.1s linear;
  }

  /* 按钮样式 */
  button {
    border: none; outline: none; cursor: pointer;
    padding: 10px 15px; border-radius: 8px;
    font-size: 13px; font-weight: 600; color: #fff;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.15s ease;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
  }
  button:hover:not(:disabled) { background: rgba(255,255,255,0.24); transform: translateY(-1px); }
  button:active:not(:disabled) { transform: translateY(1px); }
  button:disabled { opacity: 0.38; cursor: not-allowed; }
  button span.sub { font-size: 10px; opacity: 0.75; font-weight: normal; }

  .btn-accel { background: rgba(6, 214, 160, 0.28); border-color: #06d6a0; }
  .btn-accel:hover:not(:disabled) { background: rgba(6, 214, 160, 0.45); }
  .btn-brake { background: rgba(239, 71, 111, 0.28); border-color: #ef476f; }
  .btn-brake:hover:not(:disabled) { background: rgba(239, 71, 111, 0.45); }
  .btn-door { background: rgba(255, 209, 102, 0.25); border-color: #ffd166; color: #ffeaa7; }
  .btn-door.open { background: rgba(255, 209, 102, 0.55); color: #fff; }
  .btn-active { background: rgba(0, 180, 216, 0.55); border-color: #90e0ef; }

  /* 左侧上下客进度 */
  #boarding-card {
    position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
    background: rgba(10, 25, 38, 0.85);
    border: 1px solid #06d6a0;
    border-radius: 12px; padding: 14px 18px; width: 220px;
    display: none; z-index: 10;
    box-shadow: 0 8px 25px rgba(0,0,0,0.45);
  }
  #boarding-card h4 { margin: 0 0 8px 0; color: #06d6a0; font-size: 15px; }
  .stat-row.........完整代码请登录后点击上方下载按钮下载查看

网友评论0