You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

gif-countdown

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gif-countdown

Library to generate GIF countdown with customized background image and font

0.4.1
latest
Source
npmnpm
Version published
Weekly downloads
9
350%
Maintainers
1
Weekly downloads
 
Created
Source

Library to generate GIF countdown with customized background image and font

Features

  • Generate animated GIF with your preferred background image, font and countdown text
  • Show different image when the counter is zero / expired
  • For advanced use, frame delay, number of frames, number of times to repeat, gif quality and number of seconds count down can be configured

How to Use - See example folder for details

const GifCountdown = require("gif-countdown");
const path = require("path");

const gifCountdown = new GifCountdown();
await gifCountdown.loadImage(path.join(__dirname, "./assets/images/bg.png"));

// Optional - To add image when counter is to zero
// Note: It has been loaded after loadImage() and the expired image size has to be equal to counter background image
//
await gifCountdown.loadExpiredImage(path.join(__dirname, "./assets/images/expired_image.png"));

await gifCountdown.registerFontText(
  path.join(__dirname, "./assets/fonts/OpenSans-Bold.ttf"),
  "Open Sans", 40,
  (counter)=> ` ${counter.days}       ${counter.hours}       ${counter.minutes}       ${counter.seconds}`,
  "rgb(163, 168, 178)", 25, 49
);
await gifCountdown.generate("2023-01-01T23:59:59-08:00");

alt text

Sample Usage

  • Create a serverless api to serve animated countdown GIF for email campaign - https://github.com/CompAndSave/email-countdown-serverless

Keywords

countdown gif

FAQs

Package last updated on 04 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts