claygl/example/app_basic.html
pissang 6edabb3834 refact: use modern tools.
TypeScript, Prettier
2022-04-21 21:09:40 +08:00

46 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<script src="../dist/claygl.js"></script>
<title>Basic Cube</title>
</head>
<body>
<style>
html,
body,
#main {
height: 100%;
margin: 0;
}
</style>
<div id="main"></div>
<script>
var app = clay.application.create('#main', {
init: function (app) {
// Create camera
this._camera = app.createCamera([0, 2, 5], [0, 0, 0]);
// Create cube
this._cube = app.createCube({
color: '#f00'
});
// Create light
this._mainLight = app.createDirectionalLight([-1, -1, -1]);
},
loop: function (app) {
this._cube.rotation.rotateY(app.frameTime / 1000);
}
});
window.onresize = function () {
app.resize();
};
</script>
</body>
</html>