mirror of
https://github.com/pissang/claygl.git
synced 2026-01-18 16:22:29 +00:00
22 lines
401 B
TypeScript
22 lines
401 B
TypeScript
import { App3D } from 'claygl';
|
|
|
|
const app = new App3D('#main');
|
|
|
|
// Create camera
|
|
const camera = app.createCamera([0, 2, 5], [0, 0, 0]);
|
|
|
|
// Create cube
|
|
const cube = app.createCube({
|
|
color: '#f00'
|
|
});
|
|
// Create light
|
|
const mainLight = app.createDirectionalLight([-1, -1, -1]);
|
|
|
|
app.loop(() => {
|
|
cube.rotation.rotateY(app.frameTime / 1000);
|
|
});
|
|
|
|
window.onresize = function () {
|
|
app.resize();
|
|
};
|