three实现三维大转盘随机转动幸运数字代码

代码语言:html

所属分类:大转盘

代码描述:three实现三维大转盘随机转动幸运数字代码

代码标签: three 三维 大转盘 随机 转动 幸运 数字 代码

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

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

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


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


  
  
</head>

<body translate="no">
  <script type="importmap">
  {
    "imports": {
      "three": "https://unpkg.com/three@0.181.0/build/three.module.js",
      "three/addons/": "https://unpkg.com/three@0.181.0/examples/jsm/"
    }
  }
</script>
  
    <script type="module">
import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js';
import { mergeGeometries } from "three/addons/utils/BufferGeometryUtils.js";

import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';

console.clear();

// load fonts
await (async function () {
  async function loadFont(fontface) {
    await fontface.load();
    document.fonts.add(fontface);
  }
  let fonts = [
    new FontFace(
      "Anta",
      "url(https://fonts.gstatic.com/s/anta/v1/gyBzhwQ3KsIyVFs7PQ.woff2) format('woff2')"
    )
  ];
  for (let font in fonts) {
    await loadFont(fonts[font]);
  }
})();

class WheelMachine extends THREE.Group{
  constructor(){
    super();
    
    const setGColor = (g, color) => {
      const c = new THREE.Color(color);
      g.setAttribute(
        "color", 
        new THREE.Float32BufferAttribute(
          Array.from({length: g.attributes.position.count}, () => {return [...c]}).flat(), 
          3
        )
      );
    }
    
    const rWheel = 5;
    
    // <body>
      // <main arc>
        const rArc = rWheel + 0.5;
        const arcThickness = 0.5;
        const arcAngle = Math.PI * 0.875;
        c.........完整代码请登录后点击上方下载按钮下载查看

网友评论0