Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nexts-react-animated-number

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexts-react-animated-number

React component for animating numbers

  • 0.4.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-animated-number

npm version devDependency Status

React component for animating numbers

Install

react-animated-number is available via npm and can be used with browserify or webpack.

npm install --save react-animated-number

Usage

import AnimatedNumber from 'react-animated-number';
...
...

class Demo extends Component {

    ...

    render () {
        <AnimatedNumber component="text" value={bigValue}
            style={{
                transition: '0.8s ease-out',
                fontSize: 48,
                transitionProperty:
                    'background-color, color, opacity'
            }}
            frameStyle={perc => (
                perc === 100 ? {} : {backgroundColor: '#ffeb3b'}
            )}
            duration={300}
            formatValue={n => prettyBytes(n)}/>
    }
}

API

value: number

required
Numeric value to which to tween to


component: any

default: "span"
This is similar to the react transition API. By default, renders text inside a <span>. You can pass in any valid ReactElement. Use "text" for rendering into SVG.


formatValue: ?(n: number) => string

A callback function that accepts a number and returns a formatted string


duration: ?number

default: 300
Total duration of animation in milliseconds


frameStyle: ?(perc: number) => Object | void,

A callback function that accepts the percentage of completion of current animation and returns the style object to applied to the current frame


stepPrecision: ?number

The number of decimal places to render for intermediate values. If set to 0, rounds off the intermediate values using Math.round


Demo

A demo can be found here. Source code for the demo can be found here.

License

react-animated-number is licensed under MIT license.

Keywords

FAQs

Package last updated on 28 May 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc