DanielMartinus / Konfetti

Celebrate more with this lightweight confetti particle system 🎊
ISC License
3.13k stars 299 forks source link

different animation effect Issue on multiple devices #314

Closed kimyounghoons closed 9 months ago

kimyounghoons commented 1 year ago

When testing on multiple devices, there is a difference between 120 Frame device and 60 Frame device animation. How should I solve it?

DanielMartinus commented 1 year ago

There's probably an issue where the deltatime is not correctly applied to one of parameters. I should dive into this and see what's causing this.

omargda commented 10 months ago

I also observed differences in animation between a Samsung device and Google Pixel device. Samsung shoots down (as desired), but on a Pixel it shoots to the right

DanielMartinus commented 9 months ago

@omargda What configuration did you use? Can you share some more details about this specific case

kit0kat commented 9 months ago

Hi, I'm facing the same issue.

I'm using this configuration:

   val leftParty = Party(
        spread = 45,
        angle = 315,
        position = Position.Relative(0.0, 0.35),
        emitter = Emitter(duration = 3, TimeUnit.SECONDS).perSecond(30)
    )
    val rightParty = Party(
        spread = 45,
        angle = 225,
        position = Position.Relative(1.0, 0.35),
        emitter = Emitter(duration = 3, TimeUnit.SECONDS).perSecond(30)
    )
// ...
KonfettiView(
  modifier = Modifier.fillMaxSize(),
  parties = listOf(leftParty, rightParty),
)

It looks like this:

image

60 Hz is fine but 120 Hz seems broken. It looks like the confetti cannon only has half power at 120 Hz haha.

DanielMartinus commented 9 months ago

Thanks for the example! Right now the refresh rate seems to be locked at 60fps in the code. I'll make the proper adjustments and update the frame rate dynamically.

DanielMartinus commented 9 months ago

Opened a branch with a fix here: https://github.com/DanielMartinus/Konfetti/pull/319

@kit0kat @kimyounghoons would you be able to check-out that branch (add-dynamic-framerate) and run the xml or compose example on your device with 120Hz?

kit0kat commented 9 months ago

@DanielMartinus I checked out your branch and tried both XML and Compose examples. It now works perfectly at 120 Hz 👍You are amazing. When will the update be available?

DanielMartinus commented 9 months ago

@kit0kat I've just released 2.0.4 that includes the fix

kit0kat commented 9 months ago

Confirmed, fixed in production. Thank you!!