- Notifications
You must be signed in to change notification settings - Fork13
Super easy way to animate numbers with React
License
Leocardoso94/animated-number-react
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple animated number for React, usinganime.
Live demohere
$ npm install animated-number-react# OR$ yarn add animated-number-react
importAnimatedNumberfrom"animated-number-react";exportdefaultclassAppextendsComponent{state={value:150,};handleChange=({target:{ value}})=>{this.setState({ value});};formatValue=(value)=>value.toFixed(2);render(){return(<div><inputtype="number"onChange={this.handleChange}value={this.state.value}/><AnimatedNumbervalue={this.state.value}formatValue={this.formatValue}/></div>);}}
Followingprops
are used while initialization
Note : Only
value
is a required prop. Others are optional
Prop Name | Type | Description | Default Value |
---|---|---|---|
value(required) | [ Number, String] | number that will be animated | |
duration(optional) | Number | the duration of animation | 1000 |
delay(optional) | Number | the delay of animation | 0 |
className(optional) | String | an className to add to the span | null |
easing(optional) | String | you can found all valid valueshere | 'linear' |
Execute a function at the beginning, during or when an animation or timeline is completed.
Names | Types | Arguments | Info |
---|---|---|---|
formatValue | Function | valueNumber | A function that will manipulate the animated value |
update | Function | animationObject | Called at time = 0 |
run | Function | animationObject | Called after delay is finished |
begin | Function | animationObject | Called after animation delay is over |
complete | Function | animationObject | Called only after all the loops are completed |
formatValue()
is used to format the animatedValue.
update()
is called on every frame while the instance is playing.
begin()
is called once after the delay is finished.
Check if the animation has begun withmyAnimation.began
, returntrue
orfalse
.
run()
is called every frame after the delay is finished.
complete()
is called once after the animation is finished.
About
Super easy way to animate numbers with React
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.