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

代码语言:html

所属分类:三维

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

代码标签: 三维 钻石 旋转 效果

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

<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">

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

<body>
  <canvas></canvas>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.88.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/ConvexGeometry.js"></script>

    <script >
        "use strict";

var canvas = document.querySelector("canvas");
var w = window.innerWidth;
var h = window.innerHeight;
canvas.width = w;
canvas.height = h;
var renderer = new THREE.WebGLRenderer({
  canvas: canvas,
  antialias: true,
  logarithmicDepthBuffer: true
});
renderer.setSize(w, h);

var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, w / h, 0.1, 100);
camera.position.set(-3, 2.5, 5);
camera.lookAt(new THREE.Vector3(0, 0, 0));
scene.add(camera);
var light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(15, 10, 0);
scene.add(light);
light = new THREE.DirectionalLight(0x80Bfff, 1, 500);
light.position.set(-10, -16, -10);
scene.add(light);
light = new THREE.AmbientLight(0x001.........完整代码请登录后点击上方下载按钮下载查看

网友评论0