Jump to content
Search Community

Some oddities with the "number animation"

Yandex.Technologies LLC test
Moderator Tag

Recommended Posts

Good day colleagues!

I have some strangenesses with "number animation".

 

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

 

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?

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

Link to comment
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
Link to comment
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

Link to comment
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.
×
×
  • Create New...