claygl/example/app_model_animation.html

52 lines
1.3 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>Model animation</title>
</head>
<body>
<style>
html, body, #main {
height: 100%;
margin: 0;
}
</style>
<div id="main"></div>
<script>
var app = clay.application.create('#main', {
graphic: {
shadow: true
},
init: function (app) {
// Create camera
this._camera = app.createCamera([0, 150, 200], [0, 100, 0]);
// Load boombox model.
app.loadModel('./assets/models/SambaDancing/SambaDancing.gltf');
// Create light
app.createDirectionalLight([-1, -1, -1]);
// Use orbit control
this._control = new clay.plugin.OrbitControl({
target: this._camera,
domElement: app.container
});
},
loop: function (app) {
this._control.update(app.frameTime);
}
});
window.onresize = function () {
app.resize()
};
</script>
</body>
</html>