jinatonic/confetti

Why confetti recreates on top after falling down to bottom?

Kolyall opened this issue · 2 comments

I created list of BitmapConfetto with 200 different , not the same images. And I need to fall all of the to bottom from the top. But when first confetti FadeOut at the bottom, then it recreates on the top again.

  int height = container.getHeight();
        int speed = height/4;
        int acceleration = -(height/4)/8;
        final ConfettiSource confettiSource = new ConfettiSource(-container.getWidth()/4, 0,container.getWidth()/2, 0);
        confettiManager = new ConfettiManager(this, myConfettoGenerator, confettiSource, container)
                .setNumInitialCount(2)
                .setTTL(6000)
                .enableFadeOut(Utils.getDefaultAlphaInterpolator())
                .setEmissionDuration(ConfettiManager.INFINITE_DURATION)
                .setInitialRotation(180, 180)
                .setEmissionRate(4f)
                .setVelocityY(speed)
                .setAccelerationY(acceleration)
                .setRotationalVelocity(30, 60)
                .animate();

Seems like starts second wall of confetti , and the method doesn't call any more

public Confetto generateConfetto(Random random)

Creating one unique confetti per bitmap is not something the library supports at the moment. The intended usage of the library is that you provide it a set of bitmaps or confetto objects, and the framework will randomly generate confetti for the specified duration / emission rate. You would have to add custom logic to ensure that the confetti manager doesn't re-generate the same confetto.