Mateen Chaudhry
Mateen Chaudhry

Reputation: 661

ImageView fall down Animation

I am trying to achieve something like that

I have white circle image views in Stack currently I am doing like this to animate but it's not working properly please help me what am I doing wrong this my code for animating but my imageViews falls down all together viewPasscodeis Linear layout to which I add imageViews pragmatically please I need little help

private void animPass() {

        float bottomOfScreen = getResources().getDisplayMetrics()
                .heightPixels - (viewPasscode.getHeight() * 4);
        //bottomOfScreen is where you want to animate to

        for (final ImageView imageView1 : passViewsStack) {
            imageView1.animate()
                    .translationY(bottomOfScreen)
                    .setInterpolator(new AccelerateInterpolator())
                    .setInterpolator(new BounceInterpolator())
                    .setDuration(2000).setListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {

                }
                @Override
                public void onAnimationEnd(Animator animation) {
                    viewPasscode.removeView(imageView1);


                }

                @Override
                public void onAnimationCancel(Animator animation) {

                }

                @Override
                public void onAnimationRepeat(Animator animation) {

                }
            });

         }

Upvotes: 1

Views: 1597

Answers (1)

Devender Kumar
Devender Kumar

Reputation: 89

All is good. Just keep some difference of duration for respective views i.e. kepp a difference of 300-500 in .setDuration(2000). e.g.,

for view 1: .setDuration(2000) for view 2: .setDuration(1500)

so on.

you will get expected results.

Upvotes: 2

Related Questions