Created
January 3, 2013 22:17
A test to see if the HTML5 canvas element draws part of a big spritesheet on various devices. So far, it's worked for me on Chrome and Firefox, on both desktop, and Android. No luck on iOS.
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='test' width='400' height='400'></canvas> | |
<script> | |
var img = new Image(); | |
img.src = 'http://fc01.deviantart.net/fs70/f/2012/187/b/b/ben_10__my_sprite_sheet_by_pyroman16-d56744g.png'; | |
var ctx = document.getElementById('test').getContext('2d'); | |
img.onload = function() { | |
ctx.drawImage(img, 0, 0, 300, 300, 0, 0, 300, 300); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment