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>🎄 3D手势控制圣诞树相册</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

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

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

        #loading {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a472a 0%, #0d2818 50%, #0a1f14 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            z-index: 1000;
        }

        .loader {
            width: 100px;
            height: 100px;
            position: relative;
            margin-bottom: 30px;
        }

        .loader::before {
            content: '🎄';
            font-size: 60px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            animation: bounce 1s ease-in-out infinite;
        }

        @keyframes bounce {
            0%, 100% { transform: translate(-50%, -50%) scale(1); }
            50% { transform: translate(-50%, -60%) scale(1.1); }
        }

        .loading-text {
            font-size: 24px;
            color: #ff6b6b;
            text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
            animation: glow 1.5s ease-in-out infinite alternate;
        }

        @keyframes glow {
            from { text-shadow: 0 0 20px rgba(255, 107, 107, 0.5); }
            to { text-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
        }

        #videoContainer {
            position: absolute;
            bottom: 20px;
            right: 20px;
            width: 280px;
            height: 210px;
            border: 3px solid #ff6b6b;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 0 30px rgba(255, 107, 107, 0.5),
                        inset 0 0 20px rgba(255, 107, 107, 0.2);
            background: rgba(0, 0, 0, 0.5);
        }

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

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

        #hud {
            position: absolute;
            top: 20px;
            left: 20px;
            color: white;
        }

        #title {
            font-size: 36px;
            background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
            background-size: 400% 400%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: gradient 3s ease infinite;
            text-shadow: none;
            margin-bottom: 15px;
        }

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

        #instructions {
            background: rgba(0, 0, 0, 0.7);
            padding: 20px;
            border-radius: 15px;
            border: 1px solid rgba(255, 107, 107, 0.5);
            backdrop-filter: blur(10px);
            max-width: 320px;
        }

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

        #instructions ul {
            list-style: none;
        }

        #instructions li {
            padding: 8px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #instructions li:last-child {
            border-bottom: none;
        }

        .gesture-icon {
            font-size: 24px;
            width: 35px;
            text-align: center;
        }

        .gesture-text {
            color: #aaa;
        }

        .gesture-action {
            color: #6bcb77;
            margin-left: auto;
        }

        #gestureDisplay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 60px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.3s, transform 0.3s;
            text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
            z-index: 100;
        }

        #gestureDisplay.show {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1.2);
        }

        #photoViewer {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            width: 70%;
            max-width: 800px;
            background: rgba(0, 0, 0, 0.9);
            border-radius: 20px;
            padding: 20px;
            border: 3px solid #ffd93d;
            box-shadow: 0 0 50px rgba(255, 217, 61, 0.5);
            transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            z-index: 200;
        }

        #photoViewer.show {
            transform: translate(-50%, -50%) scale(1);
        }

        #photoViewer img {
            width: 100%;
            border-rad.........完整代码请登录后点击上方下载按钮下载查看

网友评论0