春节舞龙灯三维场景动画代码

代码语言:html

所属分类:其他

代码描述:春节舞龙灯三维场景动画代码

代码标签: 春节舞龙灯三维场景动画代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>中国古代春节舞龙灯 - Three.js 三维动画</title>
    <style>
        body { margin: 0; overflow: hidden; font-family: 'Microsoft YaHei', sans-serif; }
        #info {
            position: absolute;
            top: 20px;
            left: 20px;
            color: #fff;
            background: rgba(0,0,0,0.5);
            padding: 8px 16px;
            border-radius: 30px;
            pointer-events: none;
            z-index: 100;
            border: 1px solid rgba(255,215,0,0.5);
            text-shadow: 0 0 10px gold;
            letter-spacing: 2px;
            font-weight: 300;
        }
        #info span {
            color: #ffaa00;
            font-weight: bold;
        }
        .controls-note {
            position: absolute;
            bottom: 20px;
            left: 20px;
            color: rgba(255,255,255,0.6);
            font-size: 14px;
            background: rgba(0,0,0,0.3);
            padding: 4px 12px;
            border-radius: 20px;
            pointer-events: none;
            z-index: 100;
        }
    </style>
</head>
<body>
    <div id="info">🏮 中国古代 · 春节舞龙灯 🐉 <span>龙年大吉</span></div>
    <div class="controls-note">鼠标拖动查看 | 滚轮缩放 | 自动旋转中</div>

    <!-- 引入 Three.js 核心库和轨道控制器 -->
    <script type="importmap">
        {
            "imports": {
                "three": "https://unpkg.com/three@0.128.0/build/three.module.js",
                "three/addons/": "https://unpkg.com/three@0.128.0/examples/jsm/"
            }
        }
    </script>

    <script type="module">
        import * as THREE from 'three';
        import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

        // --- 初始化场景、相机、渲染器 ---
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0x0a1030); // 深蓝紫色夜空
        scene.fog = new THREE.Fog(0x0a1030, 20, 60); // 添加雾效增强景深感

        const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
        camera.position.set(15, 8, 20);
        camera.lookAt(0, 2, 0);

        const renderer = new THREE.WebGLRenderer({ antialias: t.........完整代码请登录后点击上方下载按钮下载查看

网友评论0