three+mediapipe识别摄像头手势控制三维祝福树动画效果代码

代码语言:html

所属分类:三维

代码描述:three+mediapipe识别摄像头手势控制三维祝福树动画效果代码 ,手势指南:握拳移动| 左右移动手旋转祝福树 |张开手掌 | 上下移动手缩放视角 | | 竖起食指 | 绽放美丽烟花 | | 比V手势 | 显示随机祝福语

代码标签: 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>2026新年快乐 - 手势祝福树</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            overflow: hidden;
            background: #0a0a1a;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        #canvas-container {
            width: 100vw;
            height: 100vh;
            position: relative;
        }

        #video-container {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 200px;
            height: 150px;
            border-radius: 15px;
            overflow: hidden;
            border: 3px solid rgba(255, 215, 0, 0.6);
            box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
            z-index: 100;
        }

        #video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transform: scaleX(-1);
        }

        #gesture-indicator {
            position: fixed;
            top: 180px;
            right: 20px;
            background: rgba(0, 0, 0, 0.7);
            color: #fff;
            padding: 15px 20px;
            border-radius: 10px;
            font-size: 14px;
            z-index: 100;
            border: 1px solid rgba(255, 215, 0, 0.4);
            min-width: 200px;
        }

        #gesture-indicator h3 {
            color: #ffd700;
            margin-bottom: 10px;
            font-size: 16px;
        }

        #gesture-indicator p {
            margin: 5px 0;
            opacity: 0.9;
        }

        #current-gesture {
            color: #4CAF50;
            font-weight: bold;
            font-size: 18px;
            margin-top: 10px;
        }

        #loading {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            transition: opacity 0.5s;
        }

        #loading.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .loader {
            width: 60px;
            height: 60px;
            border: 4px solid rgba(255, 215, 0, 0.3);
            border-top-color: #ffd700;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        #loading p {
            color: #ffd700;
            margin-top: 20px;
            font-size: 18px;
        }

        #instructions {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.7);
            color: #fff;
            padding: 15px 30px;
            border-radius: 25px;
            font-size: 14px;
            z-index: 100;
            text-align: center;
            border: 1px solid rgba(255, 215, 0, 0.4);
        }

        #instructions span {
            color: #ffd700;
            font-weight: bold;
        }

        .blessing-popup {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) .........完整代码请登录后点击上方下载按钮下载查看

网友评论0