florent37 / ViewAnimator

A fluent Android animation library
Apache License 2.0
2.71k stars 423 forks source link

thenAnimate() method is ignored when used before andAnimate() method #21

Open shayanzoro opened 8 years ago

shayanzoro commented 8 years ago

thenAnimate() method is ignored when used before andAnimate() method. in my example the background animation won't be played:

    ViewAnimator
                     //increase play icon's opacity
            .animate(playLogo)
            .alpha(1)
            .startDelay((long) (ANIMATION_DURATION * 0.2f))
            .duration(1)
                     //then fade the background in
            .thenAnimate(background)
            .alpha(0, 1)
            .duration((long) (ANIMATION_DURATION * 0.7f))
            .interpolator(new AccelerateDecelerateInterpolator())
            .onStart(() -> background.setVisibility(View.VISIBLE))
                    //and rotate and scale the play icon & the logo
            .andAnimate(playLogo, varaLogo)
            .rotation(0, -6 * 360)
            .scale(1, 1.25f)
            .startDelay((long) (ANIMATION_DURATION * 0.1f))
            .duration((long) (ANIMATION_DURATION * 0.4f))
            .interpolator(new AccelerateDecelerateInterpolator())
            .onStart(() -> {
                switchIconAndLogoWithDelay();
                startBackgroundAnimation();
            })
                    //after it, scale the logo a bit more
            .thenAnimate(varaLogo)
            .scale(1.25f, 1.35f)
            .duration((long) (ANIMATION_DURATION * 0.4f))
            .start();