1.0.6 • Published 1 year ago

react-hook-animate-number v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-hook-animate-number

Horizontal scroll component for javascript

NPM JavaScript Style Guide

A simple number animation using React hooks.

Try out the DEMO HERE

Install

npm install --save react-hook-animate-number

Usage

//
// \FUNCTIONAL COMPONENT
//
import React from 'react'

import useAnimateNumber from 'react-hook-animate-number'

const Example = () => {
 const animatedNumber = useAnimateNumber({ number: 1203 })
 return <>{animatedNumber.number}</>
}

Returns

{
  number: 3, // Number
  isAnimating: true, // Boolean
  isGoingUp: true // boolean
}
  • number number Returns the current number
  • isAnimating boolean Is the number currently being animated
  • isGoingUp boolean Is the number currently going up or down

Attributes

AttributeDefaultTypeDescription
number0numberThe number to display
durationInMs4000numberThe duration of the animation
decimalPlaces0numberThe number of decimal places
easingFunctionName"easeOutExpo"stringThe animation easing function name, options are: "easeInOutCubic" | "easeOutCirc" | "easeOutQuint" | "easeOutExpo"

Todo

  • Add more tests

License

MIT © desduvauchelle

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago