Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Forked from impronunciable/Makefile
Created March 5, 2014 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mickaelandrieu/9367291 to your computer and use it in GitHub Desktop.
Save mickaelandrieu/9367291 to your computer and use it in GitHub Desktop.
var casper = require('casper').create({
viewportSize: { width: 1024, height: 768 }
});
var i = 0;
var interval;
function takePictures() {
interval = setInterval(function(){
var n = ((i < 10) ? '0':'') + i;
casper.capture('image-' + (n) + '.jpg', {
top: 0,
left: 0,
width: 1024,
height: 768
});
i++;
}, 1000/8);
}
casper.start('http://casperjs.org/', function() {
takePictures();
casper.click('.nav li a');
});
casper.waitForUrl(/latest/, function(){
clearInterval(interval);
});
casper.run();
run:
casperjs index.js && convert *.jpg video.mpeg && gify video.mpeg out.gif && rm *.jpg video.mpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment