Created
April 22, 2013 10:08
-
-
Save pvdz/5433721 to your computer and use it in GitHub Desktop.
jsgif foo
This file contains hidden or 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 encoder = new GIFEncoder(); | |
encoder.setRepeat(0); // number of times the movie should loop, 0 = forever | |
encoder.setDelay(Math.floor(1000/settings.fps)); // ms delay between frames | |
encoder.start(); | |
encoder.addFrame(canvas.getContext('2d')); | |
encoder.finish(); | |
var binary_gif = encoder.stream().getData(); | |
var data_url = 'data:image/gif;base64,'+Base64.encode(binary_gif); | |
var img = document.getElementById('gifmovie'); | |
img.src = data_url; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment