Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Oskar

How to animate numbers from array

Recommended Posts

Hello I am trying to animate numbers which I will get from an API while rendering it into viewport. I have tried to do so but in my case all the instance of numbers are getting updated but I want each number should be updated upto the value I have got from API. How can I achieve this? Here is what I have tried.

 

 

Thank You!

See the Pen agNePM by patrickjane (@patrickjane) on CodePen

Link to post
Share on other sites

Hello and welcome. This question isn't very related to GSAP, but we'll try to help where we can.

 

You're passing numberCol1 into every renderNumber function call, so it will always animate up to the value of numberCol1, which in the demo is 11 (it will go to 10 since it indexes at 0). 

 

I don't understand what data you'll be getting - why is the first entry different than the later entries? Will it always be in this format?

 

Are you wanting all of the numbers to animate to their value with the same timing? How are you supposed to determine the index? Is it related to the number of entries (in this case 6)?

  • Like 5
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×