Add animation error logging
This commit is contained in:
1 parent
932beec883
commit
1d8875cd06
1 file changed
+15
-9
+15
-9
@@ -255,26 +255,32 @@
|
||||
|
||||
try {
|
||||
const landscape = new Landscape();
|
||||
addLog('Landscape created, triangles: ' + landscape.triangles.length);
|
||||
|
||||
const airplane = new Airplane();
|
||||
addLog('Objects created');
|
||||
addLog('Airplane created, vertices: ' + airplane.vertices.length);
|
||||
|
||||
function animate() {
|
||||
ctx.fillStyle = '#000';
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
try {
|
||||
ctx.fillStyle = '#000';
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
landscape.update();
|
||||
landscape.draw();
|
||||
|
||||
airplane.update();
|
||||
airplane.render();
|
||||
landscape.update();
|
||||
landscape.draw();
|
||||
|
||||
airplane.update();
|
||||
airplane.render();
|
||||
} catch (err) {
|
||||
addLog('ANIM ERR: ' + err.message + ' at line ' + (err.lineNumber || '?'));
|
||||
return;
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
animate();
|
||||
addLog('Animation started');
|
||||
} catch (e) {
|
||||
addLog('CATCH: ' + e.message);
|
||||
addLog('CATCH: ' + e.message + ' at line ' + (e.lineNumber || '?'));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user