GithubHelp home page GithubHelp logo

leocardoso94 / animated-number-react Goto Github PK

View Code? Open in Web Editor NEW
99.0 2.0 13.0 729 KB

Super easy way to animate numbers with React

License: MIT License

JavaScript 97.89% HTML 1.80% CSS 0.31%
react animation react-animations react-number-input react-library animated-number

animated-number-react's Introduction

Hello ๐ŸŒŽ, I'm Leonardo ๐Ÿ‘‹ ๐Ÿ‡ง๐Ÿ‡ท

Twitter Badge Linkedin Badge

Co-founder at Luna

animated-number-react's People

Contributors

elyobo avatar gfviegas avatar josephting avatar leocardoso94 avatar marrekk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

animated-number-react's Issues

Feature Request

I want the numbers to start animating when I scroll to the viewport of numbers . So when I scroll down and see the numbers it should start animating from zero but now when the page is reloaded and I scroll to the numbers viewport , the animation has been ended already .

Starting from zero

Hi! Firstly, I want to thank you for such a great package. In my case, I animate numbers which come from Redux. Whenever one of the numbers is updated, the value starts counting up (or down) from zero. Could you please explain what the issue, or fix it?

Include commas in value

I've tried formatting the number with the following, but it doesn't look like commas are preserved during the animation. Any ideas how I can ensure the numbers include the commas?

formatValue = (value) => value.toFixed(0).toLocaleString( "en-US" );

Feature request

Can it have an option to stop reanimating the numbers once it's done animating once?

How can i add custom styles?

The only way is updated all span tag. But that affects my others span in the proyect.

Should i add styles to span with a selector? or there is cleaner way?

Can't perform a React state update on an unmounted component.

Unmounting a component while a number is animating causes the following error.

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

Is this a bug with this component, or something I need to resolve in my own app?

Infinite loop if value prop is set to 0

Offending code:

  updateValue = (anima) => {
    this.props.update(anima)
    const {animatedValue} = this.target
    this.setState({animatedValue})
  }

Should be:

  updateValue = (anima) => {
    this.props.update(anima)
    const {animatedValue} = this.target
    if (animatedValue !== this.state.animatedValue) {
      this.setState({animatedValue})
    }
  }

Any non elastic/linear easing's do not work

Any of the easing functions do not work.

<AnimatedNumber value={20} easing={'easeInQuart'} formatValue={(value) => {
    console.log(value)
    return value;
}}/>

Received value on formatValue is "0", during the animation it is "NaN" and at the complete it is "20".

How to specify the number to start the animation?

There is a method to specify the number to start the counter? For example, if the value to reach is 3000, can I specify to start to animate from 2000 and perform only the animation on the last 1000 number?

Feature request

I've tried to partner this with numeral.js but e+0 format is not supported. It works on a normal number though. Can you add support on e+0 format?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.