Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #load #images #js #context
ADD COMMENT
Topic
Name
6+3 =