Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


D3js Canvas Study

08 Dec 2021 »

https://bocoup.com/blog/d3js-and-canvas

https://www.codegrepper.com/code-examples/javascript/canvas+load+image

function loadImage(url) {
  return new Promise(r => { let i = new Image(); i.onload = (() => r(i)); i.src = url; });
}

let img = await loadImage("./my/image/path.jpg");
ctx.drawImage(img, 0, 0);