three+mediapipe实现摄像头跟随手势控制三维飞机飞行游戏代码
代码语言:html
所属分类:游戏
代码描述:three+mediapipe实现摄像头跟随手势控制三维飞机飞行游戏代码
代码标签: three mediapipe 摄像头 跟随 手势 控制 三维 飞机 飞行 游戏 代码
下面为部分代码预览,完整代码请点击下载或在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>手势控制飞行游戏 (慢速优化版) ✈️</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
overflow: hidden;
background: #000;
font-family: 'Segoe UI', Arial, sans-serif;
}
#gameCanvas {
width: 100vw;
height: 100vh;
}
/* 视频和手势画布 */
#video {
position: fixed;
bottom: 20px;
right: 20px;
width: 240px;
height: 180px;
border-radius: 15px;
border: 3px solid #4fc3f7;
box-shadow: 0 0 30px rgba(79, 195, 247, 0.5);
transform: scaleX(-1);
z-index: 100;
opacity: 0.8; /*稍微透明一点,不挡视线*/
}
#handCanvas {
position: fixed;
bottom: 20px;
right: 20px;
width: 240px;
height: 180px;
border-radius: 15px;
pointer-events: none;
z-index: 101;
transform: scaleX(-1);
}
/* HUD 界面 */
#hud {
position: fixed;
top: 20px;
left: 20px;
color: white;
z-index: 100;
}
.hud-item {
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(10px);
padding: 10px 20px;
border-radius: 10px;
margin-bottom: 8px;
border: 1px solid rgba(255, 255, 255, 0.2);
min-width: 140px;
}
.hud-label {
font-size: 12px;
color: #aaa;
text-transform: uppercase;
letter-spacing: 2px;
}
.hud-value {
font-size: 28px;
font-weight: bold;
background: linear-gradient(135deg, #4fc3f7, #81c784);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
#speed-value {
background: linear-gradient(135deg, #ffb74d, #f06292);
-webkit-background-clip: text;
}
#instructions {
position: fixed;
top: 20px;
right: 280px;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(10px);
padding: 20px;
border-radius: 15px;
color: white;
z-index: 100;
border: 1px solid rgba(255, 255, 255, 0.2);
max-width: 280px;
}
#instructions h3 {
color: #4fc3f7;
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
}
#instructions ul {
list-style: none;
font-size: 14px;
line-height: 1.8;
}
#instructions li::before {
content: "✋ ";
}
/*.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0