claygl/example/app_material.ts
2022-05-04 15:23:50 +08:00

22 lines
427 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({
diffuseMap: 'assets/textures/crate.gif'
});
// Create light
const mainLight = app.createDirectionalLight([-1, -1, -1]);
app.loop(() => {
cube.rotation.rotateY(app.frameTime / 1000);
});
window.onresize = function () {
app.resize();
};