Created
July 11, 2013 16:47
-
-
Save fritzy/5977140 to your computer and use it in GitHub Desktop.
Want to draw a video onto a canvas? Here's how simple it is.
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
function video2Canvas(video, canvas) { | |
var ctx = canvas.getContext('2d'); | |
function draw() { | |
ctx.drawImage(video, 0, 0, video.width, video.height, 0, 0, canvas.width, canvas.height); | |
requestAnimationFrame(draw); | |
} | |
requestAnimationFrame(draw); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment