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>🖐️ 手势控制3D物体</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #0a0a0a;
color: white;
overflow: hidden;
}
#container {
display: flex;
width: 100vw;
height: 100vh;
}
#threeCanvas {
flex: 1;
height: 100vh;
}
#videoPanel {
width: 320px;
background: rgba(20, 20, 30, 0.95);
padding: 15px;
display: flex;
flex-direction: column;
border-left: 1px solid #333;
}
.panel-header {
text-align: center;
padding-bottom: 15px;
border-bottom: 1px solid #333;
}
.panel-header h2 {
font-size: 1.2rem;
margin-bottom: 5px;
}
.video-container {
position: relative;
margin: 15px 0;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}
#videoElement {
display: none;
}
#canvasElement {
width: 100%;
height: auto;
transform: scaleX(-1);
border-radius: 10px;
}
.mode-indicator {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
background: rgba(0, 0, 0, 0.7);
padding: 8px 12px;
border-radius: 20px;
font-size: 0.85rem;
text-align: center;
backdrop-filter: blur(10px);
}
.controls-info {
flex: 1;
overflow-y: auto;
}
.info-section {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
}
.info-section h3 {
font-size: 0.9rem;
color: #888;
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 8px;
}
.gesture-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.gesture-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
background: rgba(255, 255, 255, 0.03);
border-radius: 8px;
transition: all 0.3s ease;
}
.gesture-item.active {
background: rgba(76, 175, 80, 0.2);
border: 1px solid #4CAF50;
}
.gesture-icon {
font-size: 1.8rem;
width: 45px;
text-align: center;
}
.gesture-text {
flex: 1;
}
.gesture-text .name {
font-weight: bold;
font-size: 0.9rem;
}
.gesture-text .desc {
font-size: 0.75rem;
color: #888;
margin-top: 2px;
}
.status-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.status-item {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0