We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am creating an application that requires different frameRates for different "animations" I am triggering in the window. Specifically, I have an array of images I am cycling through to create an animation, but I have this happening throughout different coordinates of the window.
I want to section off a particular frameRate for a certain animation. Is their a method to run simultaneously different framerates without effecting the entire program?
here is an interesting paper discussing this:citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.9435&rep=rep1&type=pdf
Answers
Basically, no. What you would do instead is remove all calls to framerate, and have certain sections update using different timers. Here's an example:
Ah, perfect. Thanks a bunch.
Or use %
But that's less precise and less fine grained that the solution given by TfGuy44.
Thanks, PhiLho.
I'm not sure I understand why it is less precise. Could you elaborate?
Function frameRate() sets the FPS for draw() calls. And its default value is 60.
And variable frameCount stores how many times draw() was invoked!
However, there's no guarantee that draw()'s gonna finish on time to get a specified FPS.
So, that FPS is just an attempt. While mills() is independent from all that! (~~)
Anyways, if we don't need "surgical" precision, frameCount is totally usable! :bz
I would also never use framerate(FPS) to control the speed of animations, just keep it at 60 (or even 30 for a big program).
Beside what GoToLoop said, it is also less precise in the sense that you can set the millisecond interval to an arbitrary value, while if you use % you are stuck to multiples of the base frame rate. May not be a problem, depending on your needs.