Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Premature confetti fade out #205

Closed
alexbirkett opened this issue Oct 8, 2020 · 11 comments
Closed

Premature confetti fade out #205

alexbirkett opened this issue Oct 8, 2020 · 11 comments
Labels

Comments

@alexbirkett
Copy link
Contributor

alexbirkett commented Oct 8, 2020

On slower devices, the confetti fades out higher up the screen than on faster devices:

Nokia 1 OnePlus 8
@alexbirkett
Copy link
Contributor Author

Maybe the fade should be a function of the particle's Y value not time?

@DanielMartinus
Copy link
Owner

Interesting! Thanks for reporting @alexbirkett. Question, could it be that this OnePlus 8 has a 120hz display? I think it has to do with the refresh time not being calculated down to the fade.

@alexbirkett
Copy link
Contributor Author

alexbirkett commented Oct 9, 2020

But the behaviour is as expected on the OnePlus. It's the slow phones (like the Nokia phone and emulators according to my colleague) that have problems. I added support for text/emojis and the problem was even more apparent then.

@carlfindahl
Copy link
Contributor

Do you use a delta time multiplier when altering the particle attributes? If not, that might help.

@DanielMartinus
Copy link
Owner

DanielMartinus commented Oct 10, 2020

Do you use a delta time multiplier when altering the particle attributes? If not, that might help.

Yes, it's used and it seems to be used for the alpha too. I'm trying to think of a way to validate if it's because of the frame rate by perhaps limiting the fps.

@DanielMartinus
Copy link
Owner

DanielMartinus commented Oct 25, 2020

Did a quick test and forced Konfetti to draw with less frames per seconds and it indeed visibly makes the particles have a shorter lifespan (see comparison below). Since I'm not able to reproduce it I'll have to dig deeper to find out why this is happening.

~30fps ~60fps

@DanielMartinus
Copy link
Owner

Hey @alexbirkett,

The deltatime wasn't calculated on the force and acceleration. Hence it didn't reach as far on the slower phone as it did on the faster phone. Could you try and test the following version on the slower phone to see if it's fixed?

implementation 'nl.dionsegijn:konfetti:1.2.6-rc1' 

@alexbirkett
Copy link
Contributor Author

I can't find a tag for 1.2.6-rc1. When I attempt to use 'nl.dionsegijn:konfetti:1.2.6-rc1' with demo-simple-java I get a crash:

    Process: nl.dionsegijn.simple_demo, PID: 28955
    java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
        at nl.dionsegijn.konfetti.models.Shape$DrawableShape.<init>(Unknown Source:2)
        at nl.dionsegijn.simple_demo.MainActivity.onCreate(MainActivity.java:23)
        at android.app.Activity.performCreate(Activity.java:7802)
        at android.app.Activity.performCreate(Activity.java:7791)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3273)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3437)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2041)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7386)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/nl.dionsegijn.simple_demo-a0luL6QpGPUoNEidnRfcag==/base.apk"],nativeLibraryDirectories=[/data/app/nl.dionsegijn.simple_demo-a0luL6QpGPUoNEidnRfcag==/lib/arm, /system/lib, /system/product/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at nl.dionsegijn.konfetti.models.Shape$DrawableShape.<init>(Unknown Source:2) 
        at nl.dionsegijn.simple_demo.MainActivity.onCreate(MainActivity.java:23) 
        at android.app.Activity.performCreate(Activity.java:7802) 
        at android.app.Activity.performCreate(Activity.java:7791) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3273) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3437) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2041) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7386) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980) 

@DanielMartinus
Copy link
Owner

DanielMartinus commented Oct 28, 2020

@alexbirkett that's because kotlin isn't configured for this java project.

Easiest way to fix that is by adding a dummy Kotlin class file to that demo-simple-java project and then click on configure kotlin at the top of your IDE

@DanielMartinus
Copy link
Owner

@alexbirkett would it be possible to try above solution?

@DanielMartinus
Copy link
Owner

Presumably fixed with this implementation: #249

Please reopen if the problem still occurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants