claygl/example/app_basic.ts
2022-05-03 22:57:19 +08:00

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();
};