mediapipe实现摄像头离线浏览器中检测你的手势来做剪刀石头布游戏代码
代码语言:html
所属分类:游戏
代码描述:mediapipe实现摄像头离线浏览器中检测你的手势来做剪刀石头布游戏代码
代码标签: 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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
color: white;
}
h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}
.subtitle {
color: #888;
margin-bottom: 20px;
}
.game-container {
display: flex;
gap: 40px;
align-items: flex-start;
flex-wrap: wrap;
justify-content: center;
}
.video-section {
position: relative;
}
#videoElement {
display: none;
}
#canvasElement {
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
transform: scaleX(-1);
}
.gesture-overlay {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
padding: 10px 25px;
border-radius: 25px;
font-size: 1.2rem;
backdrop-filter: blur(10px);
}
.game-panel {
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
padding: 30px;
min-width: 350px;
backdrop-filter: blur(10px);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.score-board {
display: flex;
justify-content: space-around;
margin-bottom: 30px;
}
.score-item {
text-align: center;
}
.score-item .label {
font-size: 0.9rem;
color: #aaa;
margin-bottom: 5px;
}
.score-item .value {
font-size: 2.5rem;
font-weight: bold;
}
.player-score .value {
color: #4CAF50;
}
.computer-score .value {
color: #f44336;
}
.battle-area {
display: flex;
justify-content: space-around;
align-items: cente.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0