Open p0nce opened 2 years ago
Could be useful both UI-wide, and per element (use the greater of the two?). I would still want the ability to attempt 60fps (<16.6ms) for small elements though, so maybe the limit could be optional?
Could be a UIElement
field (another one) that says "don't animate me unless for at least N ms", and then they accumulate an animation "debt".
Fixed timestep can be left out I think.
Note: accumulating double dt means when the debt is paid back, the dt don't add up correctly though.
Making a limit of accumulated 20ms before calling onAnimate can save CPU at little visual cost. Could be a counter inside UIElement that is checked before calling onAnimate (eg: 20ms).
Use case 1: Note: high feedback plugins may want to synchronize feedback in the same sync queue, in order to minimize scheduler lock (exiting a tryLock is a heavy operation anyway). And then it is helpful to have onAnimate for children called just after main gui.d onAnimate. Such a UI might need both "do not animate for low dt" and "animated with fixed dt" at the same time, and will batch setDirty calls likewise.