three+gasp实现三维五子棋围棋黑白棋子排列落子动画效果代码

代码语言:html

所属分类:三维

代码描述:three+gasp实现三维五子棋围棋黑白棋子排列落子动画效果代码,点击可实现三维空间旋转。

代码标签: three gasp 三维 五子棋 围棋 黑白 棋子 排列 落子 动画

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

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

<head>
  <meta charset="UTF-8">
  


  
  
<style>
canvas {
  display: block;
  width: 100%;
  height: 100vh;
  cursor: -webkit-grab;
  cursor: grab;
}
</style>


  
</head>

<body>
    <script type="importmap">
  {
    "imports": {      
      "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/157/three.module.js",
      "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/157/jsm/"
    }
  }
</script>

  <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.11.0.js"></script>
      <script  type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';


///

const renderer = new THREE.WebGLRenderer({ antialias: true });
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(50, 2, 0.1, 100);
const controls = new OrbitControls(camera, renderer.domElement);

scene.background = new THREE.Color('white');
camera.position.set(4, 4, 4);
controls.enableDamping = true;
renderer.shadowMap.enabled = true;

///

const light = new THREE.DirectionalLight('white', Math.PI);
light.castShadow = true;
light.position.set(2, 2, -2);
scene.add(light);
scene.add(new THREE.HemisphereLight('lightblue', 'white', Math.PI));

///

scene.add(new THREE.GridHelper(6, 6));

const mat0 = new THREE.MeshPhysicalMaterial({ roughness: 1, clearcoat: 1, color: 'white' });
const mat1 = new THREE.MeshPhysicalMaterial({ roughness: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0