I load several PNG images onto my canvas, so it takes time to generate the canvas.
I want to show a loading icon when the canvas is loading. How do I check if the canvas is loading or ready?
HTML:
<canvas id="myCanvas" width="1300" height="800"></canvas>
Javascript:
function buildCanvas(settings){
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var ctx = canvas.getContext("2d");
var background = new Image();
background.onload = function() {
context.drawImage(background, 0, 0, 1300, 836);
};
background.src = 'data/skin-army.png';
}