Skip to content

Instantly share code, notes, and snippets.

@playgrdstar
Last active September 9, 2018 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save playgrdstar/2ce7954f3d441a5db06536462e0c90ed to your computer and use it in GitHub Desktop.
Save playgrdstar/2ce7954f3d441a5db06536462e0c90ed to your computer and use it in GitHub Desktop.
How to use Ccapture library in p5
var capturer = new CCapture({
format: 'jpg',
name: 'name'
});
var canvas;
function setup() {
var p5Canvas = createCanvas(800, 800);
canvas = p5Canvas.canvas;
background(0,255);
...
capturer.start();
}
function draw() {
...
// This is set to a trigger based on the number of frames that have elapsed.
// Can also be set to a mouse press event
if (frameCount < loopFrame) {
capturer.capture(canvas);
} else if (frameCount === loopFrame) {
capturer.stop();
capturer.save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment