Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Yandex.Technologies LLC

Some oddities with the "number animation"

Recommended Posts

Good day colleagues!

I have some strangenesses with "number animation".

 

This is "0 to 30, by 1 sec." example at CP

https://codepen.io/belyanskii/pen/BayOeep

 

And (- drumroll please -) - "0 to 188, by 1 sec." example at CP

See the Pen PowdrYb by belyanskii (@belyanskii) on CodePen

 

I expect to get all the numbers from 0 to 30 in 1 second, rather than getting a random number or the same number multiple times :)

Can you tell me where I made a mistake?

Share this post


Link to post
Share on other sites

It's working correctly. I think your understanding of how animations work is a little off. An animation will update about every ~16.67ms, so the chances of it updating on every number change are practically 0. You would have better luck playing the lottery. 

 

To get it working like you want might take some work. You will need to make sure a number is not already in the array, and fill in any missing numbers between the last number in the array and the current number.

 

 

  • Like 2

Share this post


Link to post
Share on other sites
50 minutes ago, OSUblake said:

It's working correctly. I think your understanding of how animations work is a little off. An animation will update about every ~16.67ms, so the chances of it updating on every number change are practically 0. You would have better luck playing the lottery. 

 

To get it working like you want might take some work. You will need to make sure a number is not already in the array, and fill in any missing numbers between the last number in the array and the current number.

 

 

 

Okay, so in order to show 30 frames per second, I need to set in what specific time to show the frame?

Like - 

See the Pen NWPLQwV by belyanskii (@belyanskii) on CodePen

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×