P5.JS multiple frame rates at any speed from 1 to 30FPS
$20-30 USD
Lukket
Slået op næsten 3 år siden
$20-30 USD
Betales ved levering
Hi, I am working in [login to view URL] and I am trying to achieve multiple frame rates for multiple animations that can have any framerate between 1FPS to 30FPS.
Here is the main question: How to keep the master FPS at frameRate(30) and then have any number of animations be at any FPS between 1-30.
The mod function will allow me to get a few divisions of FPS but this is not good enough as it goes from 30FPS and then 15FPS and that's a huge difference in speed:
if (frameCount % 2)
// Animate every other frame ~15FPS
if (frameCount % 3)
// Animate one frame out of three
[login to view URL]
So there is the timer function in milliseconds which seems like a perfect solution to achieve any FPS I want, but it simply does not keep up with 30FPS, where the same code with no timer and the standard 30 FPS runs perfectly. So it seems this method is not usable for animations?
[login to view URL]
And then there is deltaTime but I have not been able to figure it. From its description it seems to be exactly what I need but the example on the website is about moving an object on the screen at different rates vs I need the ability to change the state of an object at any FPS, like the background color, as shown in my example code.
The code provided is a simplified version of the main code but it represents the problem well. I am not looking for a code re-write necessarily, I'm interested in how else this can be done, so if you can point me to the solution that works for me too!
Hello!
I just noticed the project you posted here. I am very excited working your project with you.
I am skilled web developer with skills including JavaScript.
Please contact me to discuss more regarding this project.
Thanks