-
-
Save holysheep/2f0f446be6e751b92b0e 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
<canvas id="canvas"></canvas> | |
<script type="text/javascript"> | |
var canvas = document.getElementById('canvas'); | |
var context = canvas.getContext('2d'); | |
Image img1 = new Image(); | |
Image img2 = new Image(); | |
img1.onload = function() { | |
canvas.width = img1.width; | |
canvas.height = img1.height; | |
img2.src = 'imgfile2.png'; | |
}; | |
img2.onload = function() { | |
context.drawImage(img1, 0, 0); | |
context.drawImage(img2, 0, 0); | |
}; | |
img1.src = 'imgfile1.png'; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment