Add animation error logging

This commit is contained in:
Richard Zink committed 2026-10-06 16:22:59 +02:00
1 parent 932beec883
commit 1d8875cd06
1 file changed
+9 -3
+9 -3
View File
@@ -255,10 +255,13 @@
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() {
try {
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, width, height);
@@ -267,14 +270,17 @@
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>