-
-
Save holysheep/8c1923fade8042fa159a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.getElementById("canvas"); | |
var ctx = canvas.getContext("2d"); | |
var image1 = loadImage('http://твоя фоновая картинка', main); | |
var image2 = loadImage('http://qr код', main); | |
var imagesLoaded = 0; | |
function main() { | |
imagesLoaded += 1; | |
if(imagesLoaded == 2) { | |
// композируем картинку в одну | |
ctx.drawImage(image1, 0, 0); | |
ctx.globalAlpha = 0.5; | |
ctx.drawImage(image2, 0, 0); | |
} | |
} | |
function loadImage(src, onload) { | |
var img = new Image(); | |
img.onload = onload; | |
img.src = src; | |
return img; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment