-
Notifications
You must be signed in to change notification settings - Fork 312
Description
On Compose, when rendering particles, time is read from: withFrameMillis { frameMs ->
and deltaMs is calculated via val deltaMs = if (frameTime.value > 0) (frameMs - frameTime.value) else 0
I have emitter defined as Emitter(duration = 2000, TimeUnit.MILLISECONDS).perSecond(50)
While the particles are spawning, if you take the app to the background, wait for some time and come back, deltaMs would also include the time in the background. Let's say the app was in the background for 60 seconds. After we launch the app, it will create 60 * 50 = 3000 new particles. The greater the wait time, the more particle creation occurs. This causes ANR on some occasions.
I'd suggest either don't include the time when the app is on the background, or set default max particle as 2 * 50 = 100 in this example.
P.S. changing emitter does not respect max configuration either. Emitter(duration = 2000, TimeUnit.MILLISECONDS).perSecond(50).max(100) won't work.