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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #000;
overflow: hidden;
color: white;
}
#canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 标题 */
.title {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
font-size: 1.8rem;
font-weight: bold;
z-index: 100;
text-shadow: 0 0 20px rgba(0, 200, 255, 0.8);
background: linear-gradient(90deg, #00d4ff, #a855f7, #ff6b6b);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
pointer-events: none;
}
/* 摄像头面板 */
.camera-panel {
position: fixed;
bottom: 20px;
right: 20px;
width: 300px;
background: rgba(0, 0, 0, 0.85);
border-radius: 20px;
overflow: hidden;
z-index: 100;
border: 2px solid rgba(0, 200, 255, 0.4);
box-shadow: 0 0 30px rgba(0, 200, 255, 0.2);
}
.camera-header {
padding: 12px 18px;
background: linear-gradient(90deg, #00d4ff, #a855f7);
font-weight: bold;
display: flex;
justify-content: space-between;
align-items: center;
}
.camera-container {
position: relative;
width: 100%;
aspect-ratio: 4/3;
}
#webcam {
width: 100%;
height: 100%;
object-fit: cover;
transform: scaleX(-1);
}
#gestureCanvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: scaleX(-1);
}
.gesture-display {
padding: 15px;
background: rgba(0, 200, 255, 0.1);
text-align: center;
font-size: 1.3rem;
}
/* 手势指南 */
.gesture-guide {
position: fixed;
top: 80px;
left: 20px;
background: rgba(0, 0, 0, 0.85);
border-radius: 15px;
padding: 20px;
z-index: 100;
border: 1px solid rgba(0, 200, 255, 0.3);
max-width: 280px;
}
.gesture-guide h3 {
color: #00d4ff;
margin-bottom: 15px;
font-size: 1rem;
}
.gesture-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
margin-bottom: 8px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.03);
transition: all 0.3s;
}
.gesture-item.active {
background: rgba(0, 200, 255, 0.2);
border-left: 3px solid #00d4ff;
transform: translateX(5px);
}
.gesture-icon {
font-size: 1.8rem;
width: 40px;
text-align: center;
}
.gesture-text {
font-size: 0.9rem;
}
.gesture-desc {
font-size: 0.75rem;
color: #888;
margin-top: 3px;
}
/* 图片信息 */
.image-info {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.9);
border-radius: 20px;
padding: 15px 30px;
z-index: 100;
border: 1px solid rgba(0, 200, 255, 0.3);
text-align: center;
opacity: 0;
transition: all 0.3s;
pointer-events: none;
}
.image-info.show {
opacity: 1;
}
.image-title {
font-size: 1.3rem;
font-weight: bold;
color: #00d4ff;
}
.image-hint {
font-size: 0.85rem;
color: #888;
margin-top: 5px;
}
/* 状态指示器 */
.status-indicator {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0