Socket
Socket
Sign inDemoInstall

drain-js

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    drain-js

Makes smooth transitions between two numbers.


Version published
Maintainers
1
Created

Readme

Source

drain-js

npm License

Preview

A callback based utility for making fluent number changes.

Install

npm install drain-js
yarn add drain-js

Usage

import drain from 'drain-js';

drain({ start: 3000, end: 2750, onInterval: console.log });

// Output
2906
2812
2803
...
2752
2751
2750

Preview

Parameters

drain({
  start: Number,
  end: Number,
  speed: Number,
  onInterval: Function,
  onComplete: Function,
});
NameDefaultDescription
speed100An animation can be completed in about 10 to 20 steps. The speed (ms) value is the time set for each step.
startundefinedThe value at which the animation will start
endundefinedThe value at which the animation will end.
onIntervalundefinedThe function that will run at each step until the animation is complete.
onCompleteundefinedThe function to run when the animation is complete.

Demo List

NameStatusTypeURL
Demo Simple✔️Number TransitionLink
Demo✔️CSS Animation & Number TransitionLink
Demo with React✔️CSS Animation & Number TransitionLink
Demo with Vue✔️CSS Animation & Number TransitionLink
Demo with Svelte✔️CSS Animation & Number TransitionLink

Keywords

FAQs

Last updated on 08 Nov 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc