canvas-factory

0.0.5 • Public • Published

canvas-factory

npm version

Usage

  1. Install node-canvas.

  2. run npm install --save canvas-factory

Optional

  • Install FFmpeg if needed to save as mp4.

Example

const { createFactory } = require('canvas-factory');
const factory = createFactory({ width : 100, height : 100  });
const canvas = factory.getCanvas();
const ctx = canvas.getContext('2d');
 
const d = 10;
ctx.fillStyle = 'red';
ctx.fillText("H",10,50);
ctx.fillText("e",10+d,50);
ctx.fillText(false)("l",10+d*2,50); // pass false first to not addFrame this ctx
ctx.fillText("l",10+d*3,50);
ctx.fillText(false)("o",10+d*4,50); // pass false first to not addFrame this ctx
ctx.fillText("!",10+d*5,50);
 
factory
  .stopRecord()
  .saveGIF('test.gif')
  .saveMP4('test.mp4')
  .clearRecord()
  .startRecord()

Dependencies

node-canvas

jsgif

/canvas-factory/

    Package Sidebar

    Install

    npm i canvas-factory

    Weekly Downloads

    0

    Version

    0.0.5

    License

    MIT

    Last publish

    Collaborators

    • jeno5980515