Skip to content

Instantly share code, notes, and snippets.

@peko
Created April 23, 2016 13:25
Show Gist options
  • Select an option

  • Save peko/30793c2611834cd15f7efee6e023348e to your computer and use it in GitHub Desktop.

Select an option

Save peko/30793c2611834cd15f7efee6e023348e to your computer and use it in GitHub Desktop.
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="apng-canvas.min.js"></script>
</head>
<body>
<canvas id="cvs" with="512px" height="512px">
<script type="text/javascript">
var cvs = document.getElementById("cvs");
var ctx = cvs.getContext("2d");
APNG.parseURL("cube.png")
.then(
function(anim,e){
console.log(anim,e);
for(var i=0;i<anim.frames.length; i++) {
ctx.drawImage(anim.frames[i].img, i, i)
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment