three夜晚灯光运动反射动画效果代码

代码语言:html

所属分类:三维

代码描述:three夜晚灯光运动反射动画效果代码

代码标签: three 夜晚 灯光 运动 反射 动画

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

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

<head>

    <meta charset="UTF-8">




    <style>
        canvas {
          left: 0;
          position: absolute;
          top: 0;
        }
    </style>




</head>

<body>


    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.72.js"></script>
    <script>
        'use strict';
        
        // 
        // Constants
        //
        const lightCount = 5;
        const colors = [
        '54BE68',
        '2CB060',
        '1AA261',
        '0C8D64',
        '037868'];
        
        
        // 
        // Variabels
        // 
        const renderer = new THREE.WebGLRenderer();
        const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000);
        const scene = new THREE.Scene();
        const lights = [];
        let width, height, lastTime;
        
        
        //
        // Methods
        //
        function init() {
          const plane = new THREE.Mesh(
          new THREE.PlaneGeometry(100, 100),
          new THREE.MeshPhongMaterial({ color: 0x11111f, side: THREE.DoubleSide, opacity: .95, transparent: true }));
        
          plane.position.y = -8;
          plane.rotateX(Math.PI * -.4);
          scene.add(plane);
        
          // Create lights
          for (let i = 0; i < lightCount; i++) {
            const color = parseInt(colors[i % colors.length], 16);
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0