呼行视点 文叙 扭伤脚踝小游戏,脚踝扭伤急救小游戏

扭伤脚踝小游戏,脚踝扭伤急救小游戏

扭伤脚踝小游戏,脚踝扭伤急救小游戏

扭伤脚踝小游戏,脚踝扭伤急救小游戏

这是为您生成的一个“扭伤脚踝”主题的模拟小游戏HTML文件,它通过点击和动画,让您体验脚踝扭伤后的恢复过程。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">扭伤脚踝 · 恢复小游戏</title>
  <style>
    * {
      box-sizing: border-box;
      user-select: none;
    }
    body {
      margin: 0;
      min-height: 100vh;
      background: linear-gradient(145deg, #2b4b5c 0%, #1a2f3a 100%);
      font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }
    .game-container {
      background: #f0e7db;
      background-image: radial-gradient(circle at 30% 20%, #fff4e8, #d9cdbc);
      border-radius: 4rem 4rem 2rem 2rem;
      padding: 2rem 2.5rem 2.5rem;
      box-shadow: 0 25px 35px rgba(0, 0, 0, 0.6), inset 0 0 0 2px #fff8ee, inset 0 0 15px #b8aa98;
      max-width: 750px;
      width: fit-content;
      margin: 0 auto;
      transition: transform 0.1s;
    }
    h1 {
      text-align: center;
      font-weight: 600;
      font-size: 2.2rem;
      letter-spacing: 2px;
      color: #2f3e46;
      text-shadow: 3px 3px 0 #cbbfae, 0 6px 10px rgba(0, 0, 0, 0.2);
      margin: 0 0 0.25rem 0;
      transform: rotate(-1deg);
      font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
    }
    .subhead {
      text-align: center;
      font-size: 1.1rem;
      font-weight: 500;
      color: #3e4d57;
      background: #e3d7c9;
      display: inline-block;
      padding: 0.2rem 1.5rem;
      border-radius: 30px;
      letter-spacing: 1px;
      box-shadow: inset 0 2px 5px rgba(91, 67, 45, 0.2), 0 4px 6px rgba(0, 0, 0, 0.1);
      margin-bottom: 1.5rem;
      width: fit-content;
      margin-left: auto;
      margin-right: auto;
      border: 1px solid #bfae9a;
    }
    .canvas-wrapper {
      background: #d6c8b8;
      padding: 1rem 1rem 0.5rem 1rem;
      border-radius: 2.5rem;
      box-shadow: inset 0 0 18px #8f7e6b, 0 15px 20px rgba(0, 0, 0, 0.3);
      margin-bottom: 1.5rem;
    }
    canvas {
      display: block;
      width: 100%;
      height: auto;
      border-radius: 1.8rem;
      box-shadow: 0 0 0 3px #b8a48e, 0 12px 25px rgab(0, 0, 0, 0.5);
      background: #f9f2e9;
      cursor: pointer;
      transition: filter 0.2s;
    }
    canvas:active {
      filter: brightness(0.98);
    }
    .status-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #dbcfc0;
      border-radius: 60px;
      padding: 0.7rem 1.5rem;
      box-shadow: inset 0 3px 8px #ab9b89, 0 8px 12px rgba(0, 0, 0, 0.2);
      border: 1px solid #fff1e1;
      margin-top: 0.5rem;
    }
    .pain-meter {
      display: flex;
      align-items: center;
      gap: 0.8rem;
      font-weight: 600;
      color: #2b3b44;
      font-size: 1.3rem;
      text-shadow: 0 1px 2px white;
    }
    .pain-value {
      background: #4c2e2b;
      color: #ffdab9;
      padding: 0.15rem 0.9rem;
      border-radius: 40px;
      font-size: 1.8rem;
      font-weight: 800;
      min-width: 4rem;
      text-align: center;
      box-shadow: inset 0 -3px 0 #1f0f0e, 0 5px 0 #2e1e1c;
      line-height: 1.4;
      border: 1px solid #b1977c;
    }
    .reset-btn {
      background: #4e3e34;
      border: none;
      border-radius: 50px;
      padding: 0.8rem 1.8rem;
      font-size: 1.2rem;
      font-weight: 700;
      color: #f2e4d4;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      box-shadow: 0 8px 0 #2a1f19, 0 7px 15px rgba(0, 0, 0, 0.4);
      transition: all 0.06s linear;
      cursor: pointer;
      border: 1px solid #b6a28c;
      letter-spacing: 0.5px;
      line-height: 1;
    }
    .reset-btn:active {
      transform: translateY(6px);
      box-shadow: 0 2px 0 #2a1f19, 0 7px 15px rgba(0, 0, 0, 0.4);
    }
    .reset-btn span {
      font-size: 1.6rem;
      transform: rotate(15deg);
    }
    .hint {
      text-align: center;
      color: #4d3e31;
      margin-top: 1rem;
      font-size: 0.95rem;
      font-weight: 600;
      opacity: 0.8;
      display: flex;
      justify-content: center;
      gap: 0.7rem;
      align-items: center;
      background: #e3d7c9b0;
      padding: 0.4rem;
      border-radius: 30px;
      backdrop-filter: blur(2px);
    }
    .hint i {
      font-style: normal;
      background: #6c5b4b;
      color: #f0e2d2;
      padding: 0.2rem 0.6rem;
      border-radius: 30px;
    }
  </style>
</head>
<body>
  <div class="game-container">
    <h1>⚡ 扭伤脚踝 ⚡</h1>
    <div style="display: flex; justify-content: center;">
      <div class="subhead">点击脚踝 · 慢慢恢复</div>
    </div>
    <div class="canvas-wrapper">
      <canvas id="gameCanvas" width="600" height="280"></canvas>
    </div>
    <div class="status-bar">
      <div class="pain-meter">
        <span>😖 疼痛</span>
        <span class="pain-value" id="painDisplay">100</span>
      </div>
      <button class="reset-btn" id="resetButton">
        <span>🔄</span> 重新扭伤
      </button>
    </div>
    <div class="hint">
      <i>点击脚踝区域</i> 可减轻疼痛,等到疼痛归零就康复啦
    </div>
  </div>
  <script>
    (function() {
      const canvas = document.getElementById('gameCanvas');
      const ctx = canvas.getContext('2d');
      const painDisplay = document.getElementById('painDisplay');
      // 游戏状态
      let pain = 100;            // 0 - 100
      let isSwollen = true;
      // 脚踝热区 (圆形区域,用于点击判定)
      const ankleHotspot = {
        x: 380,
        y: 170,
        radius: 45
      };
      // 用于点击动画/闪动的变量
      let flashIntensity = 0;      // 0~1, 点击后短暂增加
      let lastClickTime = 0;
      // 恢复速率: 每次点击减少疼痛量
      const CLICK_REDUCTION = 6;
      const PASSIVE_REDUCTION = 0.01; // 每帧微小恢复,避免卡死
      // 重置状态
      function resetGame() {
        pain = 100;
        flashIntensity = 0;
        updatePainDisplay();
      }
      // 更新UI疼痛数字
      function updatePainDisplay() {
        painDisplay.textContent = Math.round(pain);
        // 根据疼痛改变颜色/样式
        if (pain <= 0) {
          painDisplay.style.background = '#2e6b4c';
          painDisplay.style.color = '#e0ffd0';
          painDisplay.style.textShadow = '0 0 8px #b6ffa0';
        } else if (pain < 30) {
          painDisplay.style.background = '#4f5e3a';
          painDisplay.style.color = '#e6f7d4';
        } else if (pain < 60) {
          painDisplay.style.background = '#6b4e2e';
          painDisplay.style.color = '#f9e5c1';
        } else {
          painDisplay.style.background = '#4c2e2b';
          painDisplay.style.color = '#ffdab9';
        }
      }
      // 处理点击——检查是否点在脚踝区域
      function handleCanvasClick(e) {
        const rect = canvas.getBoundingClientRect();
        const scaleX = canvas.width / rect.width;   // canvas物理像素比例
        const scaleY = canvas.height / rect.height;
        const mouseX = (e.clientX - rect.left) * scaleX;
        const mouseY = (e.clientY - rect.top) * scaleY;
        // 计算距离
        const dx = mouseX - ankleHotspot.x;
        const dy = mouseY - ankleHotspot.y;
        const dist = Math.sqrt(dx * dx + dy * dy);
        if (dist <= ankleHotspot.radius) {
          // 有效点击!减轻疼痛
          if (pain > 0) {
            pain = Math.max(0, pain - CLICK_REDUCTION);
            // 视觉反馈:弹一下
            flashIntensity = 1.0;
            // 如果疼痛归零,更新显示
            updatePainDisplay();
          } else {
            // 即使康复了也可以给一点小反馈
            flashIntensity = 0.6;
          }
        } else {
          // 点错位置:轻微惩罚? 我们不惩罚,但给出一点视觉提示(可忽略)
          // 为了有趣,点击空白区域闪烁一下“未命中”的灰色,但无影响
          flashIntensity = 0.2;
        }
      }
      // 画布绘制函数
      function drawScene() {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        // 1. 画背景地板/垫子
        const grad = ctx.createLinearGradient(0, 0, 0, canvas.height);
        grad.addColorStop(0, '#fff8f0');
        grad.addColorStop(0.9, '#e6d9cb');
        ctx.fillStyle = grad;
        ctx.fillRect(0, 0, canvas.width, canvas.height);
        // 画一些柔软纹理线条
        ctx.strokeStyle = '#dccfc2';
        ctx.lineWidth = 1.5;
        for (let i = 0; i < canvas.width; i += 25) {
          ctx.beginPath();
          ctx.moveTo(i, 0);
          ctx.lineTo(i + 10, canvas.height);
          ctx.strokeStyle = '#d9caba30';
          ctx.stroke();
        }
        // 2. 画腿和脚踝 (卡通风格)
        // 小腿
        ctx.save();
        ctx.shadowColor = '#7a6856';
        ctx.shadowBlur = 12;
        ctx.shadowOffsetY = 4;
        ctx.shadowOffsetX = 2;
        // 腿(肤色)
        ctx.beginPath();
        ctx.ellipse(330, 100, 45, 70, 0.1, 0, Math.PI * 2);
        ctx.fillStyle = '#fddfc4';
        ctx.fill();
        ctx.strokeStyle = '#c6a78b';
        ctx.lineWidth = 2.5;
        ctx.stroke();
        // 脚踝关节(圆形)
        ctx.beginPath();
        ctx.ellipse(380, 170, 55, 45, 0.2, 0, Math.PI * 2);
        // 填充颜色根据疼痛/恢复变化
        if (pain > 70) {
          ctx.fillStyle = '#e6a69e'; // 红肿
        } else if (pain > 30) {
          ctx.fillStyle = '#f5cfc5';
        } else {
          ctx.fillStyle = '#fde6dc'; // 恢复
        }
        ctx.fill();
        ctx.strokeStyle = '#b48b78';
        ctx.lineWidth = 3;
        ctx.stroke();
        // 脚背 / 脚掌 (向右延伸)
        ctx.beginPath();
        ctx.ellipse(445, 190, 55, 30, -0.2, 0, Math.PI * 2);
        if (pain > 70) {
          ctx.fillStyle = '#e6b3aa';
        } else if (pain > 30) {
          ctx.fillStyle = '#f5d3c8';
        } else {
          ctx.fillStyle = '#fee8dd';
        }
        ctx.fill();
        ctx.strokeStyle = '#b48b78';
        ctx.lineWidth = 3;
        ctx.stroke();
        // 脚趾: 小圆
        ctx.beginPath();
        ctx.arc(500, 185, 15, 0, Math.PI * 2);
        ctx.fillStyle = pain > 70 ? '#eba79c' : '#fce1d4';
        ctx.fill();
        ctx.strokeStyle = '#b48b78';
        ctx.lineWidth = 2.5;
        ctx.stroke();
        ctx.beginPath();
        ctx.arc(520, 200, 12, 0, Math.PI * 2);
        ctx.fillStyle = pain > 70 ? '#eba79c' : '#fce1d4';
        ctx.fill();
        ctx.stroke();
        // 肿胀效果/绷带 (根据疼痛显示)
        if (pain > 50) {
          // 红肿胀痛效果:在脚踝上画一些红色“炎症”线条
          ctx.beginPath();
          ctx.arc(380, 170, 55, 0, Math.PI * 2);
          ctx.strokeStyle = `rgba(220, 80, 70, ${0.3 + 0.2 * Math.sin(Date.now() / 300)})`;
          ctx.lineWidth = 5;
          ctx.stroke();
          // 加一些肿胀小线条
          for (let i = 0; i < 6; i++) {
            let angle = i * 1.0 + Date.now() / 1000;
            let offsetX = Math.cos(angle) * 60;
            let offsetY = Math.sin(angle) * 50;
            ctx.beginPath();
            ctx.moveTo(380 + offsetX * 0.6, 170 + offsetY * 0.6);
            ctx.lineTo(380 + offsetX, 170 + offsetY);
            ctx.strokeStyle = `rgba(200, 50, 40, ${0.2 + 0.15 * Math.sin(Date.now() / 200 + i)})`;
            ctx.lineWidth = 4;
            ctx.stroke();
          }
        } else if (pain > 0) {
          // 轻度不适:淡红色轮廓
          ctx.beginPath();
          ctx.arc(380, 170, 55, 0, Math.PI * 2);
          ctx.strokeStyle = `rgba(220, 160, 150, ${0.2 + 0.1 * Math.sin(Date.now() / 500)})`;
          ctx.lineWidth = 4;
          ctx.stroke();
        }
        // 如果疼痛接近0,画一个小星星康复标志
        if (pain < 5) {
          ctx.shadowBlur = 15;
          ctx.shadowColor = '#ffe584';
          ctx.font = 'bold 28px "Segoe UI", sans-serif';
          ctx.fillStyle = '#ffcf4a';
          ctx.fillText('✨', 330, 80);
          ctx.shadowBlur = 0;
        }
        // 3. 绘制脚踝周围的热区提示 (半透明圈)
        const hotspotGrad = ctx.createRadialGradient(
          ankleHotspot.x, ankleHotspot.y, 10,
          ankleHotspot.x, ankleHotspot.y, ankleHotspot.radius
        );
        hotspotGrad.addColorStop(0, 'rgba(255, 255, 255, 0.2)');
        hotspotGrad.addColorStop(0.6, 'rgba(230, 230, 250, 0.15)');
        hotspotGrad.addColorStop(1, 'rgba(200, 220, 240, 0.05)');
        ctx.beginPath();
        ctx.arc(ankleHotspot.x, ankleHotspot.y, ankleHotspot.radius, 0, Math.PI * 2);
        ctx.fillStyle = hotspotGrad;
        ctx.fill();
        ctx.strokeStyle = `rgba(255, 240, 200, ${0.5 + 0.2 * Math.sin(Date.now() / 300)})`;
        ctx.lineWidth = 2.5;
        ctx.setLineDash([10, 8]);
        ctx.stroke();
        ctx.setLineDash([]); // 重置
        // 4. 点击反馈闪光
        if (flashIntensity > 0.01) {
          ctx.beginPath();
          ctx.arc(ankleHotspot.x, ankleHotspot.y, ankleHotspot.radius + 5, 0, Math.PI * 2);
          ctx.fillStyle = `rgba(255, 255, 200, ${flashIntensity * 0.5})`;
          ctx.fill();
          flashIntensity *= 0.92; // 衰减
          if (flashIntensity < 0.02) flashIntensity = 0;
        }
        // 5. 写字提示 (手指图标)
        ctx.font = 'bold 16px "Segoe UI", sans-serif';
        ctx.fillStyle = '#4f3e32';
        ctx.shadowBlur = 0;
        ctx.fillText('👆 点击脚踝', 290, 35);
        // 显示疼痛<10时显示“快好了”
        if (pain < 15 && pain > 0) {
          ctx.font = 'bold 20px "Segoe UI"';
          ctx.fillStyle = '#456b45';
          ctx.fillText('快康复啦...', 410, 60);
        } else if (pain <= 0) {
          ctx.font = 'bold 22px "Segoe UI"';
          ctx.fillStyle = '#2e6b4c';
          ctx.fillText('康复!🎉', 420, 60);
        }
        ctx.restore();
      }
      // 动画循环 (每帧调用)
      function gameLoop() {
        // 被动恢复:如果游戏还没完全康复,每帧微量减少疼痛(让等待也能恢复一点点)
        if (pain > 0) {
          pain = Math.max(0, pain - PASSIVE_REDUCTION);
          updatePainDisplay();
        }
        // 绘制场景
        drawScene();
        requestAnimationFrame(gameLoop);
      }
      // 事件绑定
      canvas.addEventListener('click', handleCanvasClick);
      // 重置按钮
      document.getElementById('resetButton').addEventListener('click', () => {
        resetGame();
        // 重置时也让闪烁归零
        flashIntensity = 0;
      });
      // 移动端触摸支持(避免双击缩放)
      canvas.addEventListener('touchstart', (e) => {
        e.preventDefault();  // 阻止滚动/缩放
        const touch = e.touches[0];
        const fakeMouseEvent = {
          clientX: touch.clientX,
          clientY: touch.clientY,
        };
        // 手动调用逻辑,复用handleCanvasClick (需要模拟事件对象)
        const rect = canvas.getBoundingClientRect();
        const scaleX = canvas.width / rect.width;
        const scaleY = canvas.height / rect.height;
        const mouseX = (fakeMouseEvent.clientX - rect.left) * scaleX;
        const mouseY = (fakeMouseEvent.clientY - rect.top) * scaleY;
        const dx = mouseX - ankleHotspot.x;
        const dy = mouseY - ankleHotspot.y;
        const dist = Math.sqrt(dx * dx + dy * dy);
        if (dist <= ankleHotspot.radius) {
          if (pain > 0) {
            pain = Math.max(0, pain - CLICK_REDUCTION);
            flashIntensity = 1.0;
            updatePainDisplay();
          } else {
            flashIntensity = 0.6;
          }
        } else {
          flashIntensity = 0.2;
        }
      }, { passive: false });
      // 启动
      resetGame();
      // 初始pain显示
      updatePainDisplay();
      // 开始动画循环
      gameLoop();
    })();
  </script>
</body>
</html>

游戏机制与视觉反馈

点击脚踝区域来减轻疼痛,直到疼痛值归零,脚踝就康复了,游戏通过视觉和数字变化,实时反馈您的操作效果。

  • 核心交互:您需要将鼠标或手指对准画布中脚踝的位置进行点击,每次有效点击都会减少一定量的“疼痛值”,并伴有闪光反馈。
  • 状态变化:脚踝的颜色和肿胀效果会随疼痛值改变,疼痛值越高,脚踝越红、肿胀线条越明显;疼痛值归零时,会出现康复的星星标志。
  • 辅助机制:疼痛值会随时间微量自动减少,避免游戏卡死,底部的“重新扭伤”按钮可以重置游戏,让您重新开始。

扭伤脚踝小游戏,脚踝扭伤急救小游戏

本文来自网络,不代表大媒体立场,转载请注明出处:https://m.hushing.net/news-m/4716.html

作者: admin

呼行擅长以细腻笔触描绘现代人情感困境/呼行以独特视角解读科技人文交叉领域
下一篇
http://hushing.net/zb_users/upload/2026/11/20261116075046179478664645129.jpg

玩家必备“新天道金花怎么买房卡”详细房卡使用教程

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

工作时间:周一至周五,9:00-17:30,节假日休息

微信扫一扫关注我们