mirror of
https://github.com/pissang/claygl.git
synced 2026-01-18 16:22:29 +00:00
21 lines
448 B
TypeScript
21 lines
448 B
TypeScript
import { App3D, OrbitControl } from 'claygl';
|
|
const app = new App3D('#main');
|
|
// Create camera
|
|
const camera = app.createCamera([0, 2, 4], [0, 0, 0]);
|
|
|
|
// Create light
|
|
app.createDirectionalLight([-1, -1, -1]);
|
|
|
|
// Use orbit control
|
|
const control = new OrbitControl({
|
|
target: camera,
|
|
domElement: app.container,
|
|
timeline: app.timeline
|
|
});
|
|
|
|
app.loadModel('./assets/models/Duck_Embedded.gltf');
|
|
|
|
window.onresize = function () {
|
|
app.resize();
|
|
};
|