Threeasy
v0.1.20
Importing Models
At present only GLTF is supported To import a model you need to follow the same preload routine as with a texture. However, as with a regular ThreeJS project, we need to import the GLTFLoader. Passing this in the settings object to Threeasy will have it set up all your loading needs.
Import trophy GLTF
import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
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");
app.postload(() => {
app.scene.add(app.trophy);
app.animate(() => {
app.trophy.rotation.y += 0.01;
});
});
See example