|
|
|
@ -2,14 +2,13 @@ const Canvas = require(`canvas`);
|
|
|
|
|
const GIFEncoder = require(`gifencoder`);
|
|
|
|
|
|
|
|
|
|
module.exports = class Blink {
|
|
|
|
|
|
|
|
|
|
async getImage( ...images) {
|
|
|
|
|
async getImage(delay, ...images) {
|
|
|
|
|
if (!images || images.length < 2) throw new Error(`You must provide at least two images.`);
|
|
|
|
|
|
|
|
|
|
const GIF = new GIFEncoder(480, 480);
|
|
|
|
|
GIF.start();
|
|
|
|
|
GIF.setRepeat(0);
|
|
|
|
|
GIF.setDelay(1000);
|
|
|
|
|
GIF.setDelay(delay);
|
|
|
|
|
GIF.setTransparent();
|
|
|
|
|
|
|
|
|
|
const canvas = Canvas.createCanvas(480, 480);
|
|
|
|
|