three实现一个三维亮晶晶的钻石旋转效果代码

代码语言:html

所属分类:三维

代码描述:three实现一个三维亮晶晶的钻石旋转效果代码

代码标签: three 三维 亮晶晶 钻石 旋转

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

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        body {
        	overflow: hidden;
        	margin: 0;
        	padding: 0;
        }
    </style>


</head>

<body>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/DRACOLoader.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/GLTFLoader.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/RGBELoader.128.js"></script>
    <script>
        const aspect = window.innerWidth / window.innerHeight;
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0x444444);
        const camera = new THREE.PerspectiveCamera(75, aspect, 0.1, 1000);
        let time = 0;
        
        const renderer = new THREE.WebGLRenderer();
        renderer.setPixelRatio(window.devicePixelRatio);
        renderer.setSize(window.innerWidth, window.innerHeight);
        document.body.appendChild(renderer.domElement);
        
        const ambient = new THREE.AmbientLight(0x404040); // soft white light
        scene.add(ambient);
        const hemi = new THREE.HemisphereLight(0xffffbb, 0x080820, 1);
        scene.add(hemi);
        
        const controls = new THREE.OrbitControls(camera, renderer.domElement);
        camera.position.z = 4;
        
        let diamond;
        
        function animate() {
          requestAnimationFrame(animate);
        
       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0