Created
June 10, 2020 17:53
-
-
Save aresnick/fd706272976c3cc8bf39289f9b9b37a8 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 takeSnapshot = function() { | |
// A function to take a snapshot | |
var canvas = document.querySelector('canvas'); // Grab the canvas | |
var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); // Save the image | |
setTimeout(function() { window.location.href=image; }, 100); // Wait a bit to download the image; probably should use an event listener instead | |
} | |
// Regularly take a snapshot every 200ms | |
var timer = setInterval(takeSnapshot, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment