mediapipe+three实现炫酷摄像头识别手势控制圣诞树相册旋转缩放动画效果代码

代码语言:html

所属分类:画廊相册

代码描述:mediapipe+three实现炫酷摄像头识别手势控制圣诞树相册旋转缩放动画效果代码

代码标签: mediapipe three 炫酷 摄像头 识别 手势 控制 圣诞树 相册 旋转 缩放 动画

下面为部分代码预览,完整代码请点击下载或在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;
            font-family: 'Microsoft YaHei', sans-serif;
            background: linear-gradient(135deg, #0c1445 0%, #1a0a2e 50%, #0d0d0d 100%);
        }

        #container {
            width: 100vw;
            height: 100vh;
        }

        /* 视频容器 */
        #videoContainer {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 240px;
            height: 180px;
            border: 3px solid rgba(255, 215, 0, 0.8);
            border-radius: 15px;
            overflow: hidden;
            z-index: 1000;
            box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
            background: #000;
        }

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

        #handCanvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            transform: scaleX(-1);
        }

        /* UI面板 */
        #ui {
            position: fixed;
            top: 20px;
            left: 20px;
            z-index: 1000;
            color: white;
        }

        #title {
            font-size: 36px;
            margin-bottom: 15px;
            text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
            background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf63, #ff6b6b);
            background-size: 300% 300%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: gradient 3s ease infinite;
        }

        @keyframes gradient {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        .stat-box {
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(10px);
            padding: 12px 20px;
            border-radius: 25px;
            margin: 8px 0;
            display: inline-block;
            border: 1px solid rgba(255, 215, 0, 0.3);
            font-size: 16px;
        }

        #gesture {
            font-size: 20px;
        }

        /* 操作说明 */
        #instructions {
            position: fixed;
            bottom: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            padding: 20px;
            border-radius: 15px;
            color: white;
            z-index: 1000;
            border: 1px solid rgba(255, 215, 0, 0.3);
            max-width: 280px;
        }

        #instructions h3 {
            color: #ffd93d;
            margin-bottom: 15px;
            font-size: 18px;
        }

        #instructions p {
            margin: 10px 0;
            font-size: 14px;
            line-height: 1.5;
        }

        /* 照片查看器 */
        #photoViewer {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        #photoViewer.show {
            display: flex;
            opacity: 1;
        }

        #photoViewer img {
            max-width: 80%;
            max-height: 80%;
            border-radius: 15px;
            box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
            border: 5px solid #ffd93d;
        }

        #photoViewer .close-hint {
            position: absolute;
            bottom: 50px;
            color: white;
            font-size: 18px;
        }

        /* 加载界面 */
        #loading {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #0c1445, #1a0a2e);
            display: flex;
            flex-di.........完整代码请登录后点击上方下载按钮下载查看

网友评论0