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