Threeasy
v0.1.20
Using other ThreeJS functionality
This is getting more advanced, but anything you can do with ThreeJS you can
do with Threeasy, because Threeasy is just ThreeJS loaded a particular way.
For example if you wanted to use OrbitControls
, you just need to
instantiate them as normal, you just need to remember that the Camera
and
Renderer
are on the app
variable.
Using OrbitControls
import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { OrbitControls } from "three/addons/controls/OrbitControls";
import Threeasy from "threeasy";
/*
Trophy by Casey Tumbers
[CC-BY] (https://creativecommons.org/licenses/by/3.0/)
via Poly Pizza (https://poly.pizza/m/6Xu7mttjodo)
*/
const app = new Threeasy(THREE, {
preload: {
trophy: "/examples/models/trophy.glb",
},
GLTFLoader,
});
app.scene.background = new THREE.Color("dodgerblue");
new OrbitControls(app.camera, app.renderer.domElement);
app.postload(() => {
app.scene.add(app.trophy);
app.animate(() => {
app.trophy.rotation.y += 0.01;
});
});
See example