metasidd / Orb

A mesmerizing orb, fully designed in SwiftUI.
https://siddhant.ca
MIT License
195 stars 12 forks source link

Dropped frames when transitioning in between app states #3

Open JulianDMartinez opened 2 weeks ago

JulianDMartinez commented 2 weeks ago

Noticed that transitioning in between app states produces dropped frames that are noticeable.

Wonder if it's not too bad of a lift to add handling for this.

https://github.com/user-attachments/assets/e987b7c5-a0da-4471-976f-79ffa37dd29a

metasidd commented 1 week ago

What would the handling look like?

Do you expect the orb to...

I'm leaning toward Option 3. I'd be curious to hear of a use case for this before polishing it up.

JulianDMartinez commented 1 week ago

Looking at it, there does seem to be a technical limitation since we are already animating continuously across scene phase changes.

To make it smoother, I'm thinking we can pause the animation and restart it where it left off when the scenePhase changes to active. This way we reduce the perception of it stuttering. I can get a PR together.

JulianDMartinez commented 1 week ago

Opened this PR with pausing a resuming animations on scenePhase change. It includes delays to account for longer app rendering start up when opening from background or the app switcher.