My code is designed to create an animation using 3 canvases: one for the base image, one for the streamline wind map drawing, and another for an image covering part of the drawing. The following code displays the uploading of two images.
var img = document.createElement("img");
var cvrimg = document.createElement("cvrimg");
img.src = "https://cors-anywhere.herokuapp.com/www.example.com/img.png";
cvrimg.scr = "https://cors-anywhere.herokuapp.com/www.example.com/img-two.png";
img.crossOrigin = "anonymous";
cvrimg.crossOrigin = "anonymous";
img.onload = function () {
imgctx.drawImage(img, 10, 10);
cvrimg.onload = function () {
console.log("maybe");
cvrctx.drawImage(cvrimg,10,10);
startDrawing(wdDataArr,wsDataArr,dataManArr,pastDataArr,onlineArr);
}
}
After adding some log statements to my code, I noticed that the cvrimg.onload
function was not being called, and only one image was being queried in the network tab of the Chrome inspect tool.
Any tips or advice would be greatly appreciated by this aspiring programmer.
Thank you.