three做个微观生态缸三维游戏代码

代码语言:html

所属分类:其他

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

代码描述:三维微观生态缸网页游戏

代码标签: three 微观 生态 缸 三维 游戏 代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>微观生态缸 — Three.js</title>
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { width: 100%; height: 100%; overflow: hidden; background: #050806; }
  canvas { display: block; }

  #ui {
    position: fixed;
    top: 18px;
    left: 18px;
    width: 290px;
    z-index: 10;
    color: #d8f0dc;
    background: rgba(8, 18, 12, 0.72);
    border: 1px solid rgba(120, 220, 140, 0.18);
    border-radius: 14px;
    padding: 16px 16px 12px;
    backdrop-filter: blur(10px);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  }

  #ui h1 {
    font-size: 16px;
    letter-spacing: 2px;
    color: #9fe8a8;
    margin-bottom: 12px;
    font-weight: 700;
  }

  .row {
    margin-bottom: 11px;
  }

  .row label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #b8d9bc;
    margin-bottom: 4px;
  }

  .row input[type="range"] {
    width: 100%;
    accent-color: #59c36a;
    cursor: pointer;
  }

  .buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0 10px;
  }

  .buttons button {
    flex: 1;
    border: 1px solid rgba(130, 230, 150, 0.22);
    background: rgba(28, 58, 36, 0.58);
    color: #c9ecd0;
    border-radius: 9px;
    padding: 7px 0;
    font-size: 12px;
    cursor: pointer;
    transition: 0.18s ease;
  }

  .buttons button:hover {
    background: rgba(48, 96, 58, 0.72);
  }

  .buttons button.active {
    background: rgba(64, 145, 80, 0.42);
    border-color: rgba(160, 255, 180, 0.45);
  }

  #state-panel {
    margin-top: 8px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0,0,0,0.18);
    font-size: 12px;
    line-height: 1.75;
  }

  .state-badge {
    display: inline-block;
    min-width: 72px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    color: white;
    font-weight: 700;
    font-size: 11px;
  }

  .state-growing { background: #2e7d32; }
  .state-mature { background: #558b2f; }
  .state-wet { background: #0277bd; }
  .state-stressed { background: #ef6c00; }
  .state-wilting { background: #bf360c; }

  #hint {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    z-index: 10;
    color: rgba(220, 245, 225, 0.45);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    pointer-events: none;
  }
</style>
</head>
<body>
  <div id="ui">
    <h1>🌿 微观生态缸</h1>

    <div class="row">
      <label>
        <span>🌧️ 降雨强度</span>
        <span id="rain-val">0.00</span>
      </label>
      <input id="rain-slider" type="range" min="0" max="1" step="0.01" value="0" />
    </div>

    <div class="row">
      <label>
        <span>🌫️ 体积雾浓度</span>
        <span id="fog-val">0.30</span>
      </label>
      <input id="fog-slider" type="range" min="0" max="1" step="0.01" value="0.3" />
    </div>

    <div class="row">
      <label>
        <span>☀️ 光照强度</span>
        <span id="light-val">0.70</span>
      </label>
      <input id="light-slider" type="range" min="0" max="1" step="0.01" value="0.7" />
    </div>

    <div class="row">
      <label>
        <span>💧 环境湿度</span>
        <span id="humidity-val">0.50</span>
      </label>
      <input id="humidity-slider" type="range" min="0" max="1" step="0.01" value="0.5" />
    </div>

    <div class="buttons">
      <button id="btn-auto" class="active">🔄 自动天气</button>
      <button id="btn-reset">🔁 重置生态</button>
    </div>

    <div id="state-panel">
      <div>植物状态:<span id="plant-state" class="state-badge state-growing">🌱 生长</span></div>
      <div>叶片湿度:<span id="leaf-wet">0.25</span></div>
      <div>生长进度:<span id="growth-progress">35%</span></div>
      <div>生态时间:<span id="eco-time">00:00</span></div>
    </div>
  </div>

  <div id="hint">拖拽旋转视角 · 滚轮缩放 · 调节天气参数或开启自动天气</div>

  <script type="importmap">
    {
      &q.........完整代码请登录后点击上方下载按钮下载查看

网友评论0