three加载三维叉车模型stl文件代码

代码语言:html

所属分类:三维

代码描述:three加载三维叉车模型stl文件代码

代码标签: three 加载 三维 叉车 模型 stl 代码

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

<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

    <style>
        :root {
          --themeColor: #0072ff;
          --secondColor: #00c6ff;
        }
        * {
          margin: 0;
          padding: 0;
        }
        html {
          background: var(--themeColor);
          background: -webkit-linear-gradient(to left, var(--themeColor) , var(--secondColor));
          background: linear-gradient(to left, var(--themeColor), var(--secondColor));
        }
        body {
      
          font-family: Arial, Helvetica, sans-serif;
        }
    </style>
</head>

<body>

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.126.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/STLLoader.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/Stats-16.js"></script>
    <script>
        var container, stats, controls, compose;
        var camera, scene, renderer, light, clickableObjects = [];
        var clock = new THREE.Clock();
        var mixer, mixerArr = [], manMixer;
        init();
        animate();
        function init() {
          container = document.createElement('div');
          document.body.appendChild(container);
          // 场景
          scene = new THREE.Scene();
    
    
          // 透视相机:视场、长宽比、近面、远面
          camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
          camera.position.set(0, 4, 16);
          // 平行光
          light = new THREE.DirectionalLight(0x2d2d2d);
          light.position.set(0, 40, 10);
          light.castShadow = true;
          scene.add(light);
          // 环境光
          var ambientLight = new THREE.AmbientLight(0xffffff, .9);
          scene.ad.........完整代码请登录后点击上方下载按钮下载查看

网友评论0