1. 程式人生 > >three.js學習(3):匯入threejs

three.js學習(3):匯入threejs

1.在HTML中匯入:

2.用js中匯入:
(1)當你的檔案中內建的有一些匯入工具像Webpack或Browserify,你可以用

var THREE = require("three");
var scene = THREE.Scene();

(2)使用ES6的語法形式(如果你的瀏覽器支援的話)

import * as THREE from 'three';
const scene = THREE.Scene();

也可以單獨匯入某個模組:

import {Scene} from 'three';
const scene = Scene();