Answers for "load images js context"

0

load images js context

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);
Posted by: Guest on April-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language