three做个三维九龙拉棺场景代码

代码语言:html

所属分类:其他

代码由qwen-3.8-max ai生成,可能有错误,仅供参考:点击查看提示词

代码描述:三维九龙拉棺

代码标签: 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; background: #000; }
        canvas { display: block; }
        #info {
            position: absolute;
            top: 10px;
            width: 100%;
            text-align: center;
            color: #c8a44e;
            font-family: 'KaiTi', 'STKaiti', serif;
            font-size: 28px;
            text-shadow: 0 0 20px #c8a44e, 0 0 40px #8b6914;
            pointer-events: none;
            z-index: 10;
        }
    </style>
</head>
<body>
<div id="info">九龙拉棺</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
// ==================== 场景初始化 ====================
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0a0a12);
scene.fog = new THREE.FogExp2(0x0a0a12, 0.008);

const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 25, 60);
camera.lookAt(0, 0, 0);

const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 0.8;
document.body.appendChild(renderer.domElement);

// ==================== 灯光系统 ====================
const ambientLight = new THREE.AmbientLight(0x1a1a2e, 0.3);
scene.add(ambientLight);

const dirLight = new THREE.DirectionalLight(0x4444aa, 0.5);
dirLight.position.set(-20, 40, -20);
dirLight.castShadow = true;
dirLight.shadow.mapSize.set(2048, 2048);
scene.add(dirLight);

// 棺材上方的神秘光
const coffinLight = new THREE.PointLight(0xc8a44e, 2, 40);
coffinLight.position.set(0, 15, 0);
coffinLight.castShadow = true;
scene.add(coffinLight);

// 红色环境光
const redLight1 = new THREE.PointLight(0xff2200, 1.5, 50);
redLight1.position.set(20, 10, 20);
scene.add(redLight1);

const redLight2 = new THREE.PointLight(0xff2200, 1.5, 50);
redLight2.position.set(-20, 10, -20);
scene.add(redLight2);

// ==================== 材质定义 ====================
const goldMaterial = new THREE.MeshStandardMaterial({
    color: 0xc8a44e,
    metalness: 0.8,
    roughness: 0.3,
    emissive: 0x3a2a00,
    emissiveIntensity: 0.3
});

const darkGoldMater.........完整代码请登录后点击上方下载按钮下载查看

网友评论0