/gif-capture-canvas

Capture a canvas with an animated gif

Primary LanguageJavaScriptMIT LicenseMIT

gif-capture-canvas

Capture a canvas with an animated gif (using jsgif).

Demo

demo

Usage

% npm i gif-capture-canvas
  • Capture HTMLCanvasElement in a requestAnimationFrame loop.

see: src/samples/lineart.ts

// capture the canvas
gcc.capture(canvas);
  • Push the capturing key (default: 'C') to output an animated gif.

Configuration

// set options (default values are shown below)
gcc.setOptions({
  scale: 0.5,
  durationSec: 3,
  keyCode: 67, // 'C'
  capturingFps: 20,
  appFps: 60,
  isAppendingImgElement: true,
  quality: 10,
  downloadFileName: null,
  isSmoothingEnabled: true
});