UI Frame Event

Is there any of triggering and event or method per frame based on whatever the refresh rate is.

I would love to get smoother animation of VU’s FFT’s Graphs e.t.c. and most frame works have some onFrame or new frame event trigger. Does juce have this?

EDIT: Is there a method on the UI thread that I can override that gets triggered once per frame?

EDIT: Would calling repaint on the main paint method achieve this as the it would just requeue on messages and get repainted next time its ready?

AFAIK the best way to achieve this currently is to use OpenGL

1 Like

What this would achieve is, that your message queue is clogged, render it unresponsive for any other user interaction.

I think you may be looking for AsyncUpdater.
triggerAsyncUpdate() when a frame is ready, and the message manager will call handleAsyncUpdate() asap.

Actually in the end of paint I have an update() method which does some checks and calls repaint again if necessary. This doesn’t actually clog the queue because it’s only added after the component finishes rendering on that frame. The animation I’m doing has a simple delta change in time which I use to keep everything frame rate agnostic.

It works surprisingly well.

So the update is in charge, if a new frame has arrived?
In that case, yes, that sounds reasonable.
In the end it is the same design pattern like AsyncUpdater…

Yeah suppose it is - will check out the AsyncUpdater though. but I do like knowing the exact logic. The juce component model is slightly less intuitive than other component based frame works when it comes to things like animation, buffering and opacity