Search in sources :

Example 1 with PuffOutAnimation

use of com.marshalchen.common.uimodule.easyandroidanimations.PuffOutAnimation in project UltimateAndroid by cymcsg.

the class AnimationDetailFragment method doAnimation.

/**
     * This method performs the various animations available in the
     * AndroidAnimator library.
     */
private void doAnimation() {
    switch(mItem.id) {
        case 1:
            new BlindAnimation(card).animate();
            break;
        case 2:
            new BlinkAnimation(card).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 3:
            new BounceAnimation(card).setNumOfBounces(3).setDuration(Animation.DURATION_SHORT).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 4:
            new ExplodeAnimation(card).animate();
            break;
        case 5:
            new FadeInAnimation(card).animate();
            break;
        case 6:
            new FadeOutAnimation(card).animate();
            break;
        case 7:
            new FlipHorizontalAnimation(card).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 8:
            new FlipHorizontalToAnimation(card).setFlipToView(card2).setInterpolator(new LinearInterpolator()).animate();
            break;
        case 9:
            new FlipVerticalAnimation(card).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 10:
            new FlipVerticalToAnimation(card).setFlipToView(card2).setInterpolator(new LinearInterpolator()).animate();
            break;
        case 11:
            card2.setVisibility(View.VISIBLE);
            new UnfoldAnimation(card).setNumOfFolds(10).setDuration(1000).setOrientation(Orientation.HORIZONTAL).animate();
            break;
        case 12:
            card2.setVisibility(View.VISIBLE);
            new FoldAnimation(card).setNumOfFolds(10).setDuration(1000).setOrientation(Orientation.VERTICAL).animate();
            break;
        case 13:
            new HighlightAnimation(card).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 14:
            ArrayList<Point> points = new ArrayList<>();
            points.add(new Point(0, 100));
            points.add(new Point(50, 0));
            points.add(new Point(100, 100));
            points.add(new Point(0, 50));
            points.add(new Point(100, 50));
            points.add(new Point(0, 100));
            points.add(new Point(50, 50));
            new PathAnimation(card).setPoints(points).setDuration(2000).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 15:
            new PuffInAnimation(card).animate();
            break;
        case 16:
            new PuffOutAnimation(card).animate();
            break;
        case 17:
            new RotationAnimation(card).setPivot(RotationAnimation.PIVOT_TOP_LEFT).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 18:
            new ScaleInAnimation(card).animate();
            break;
        case 19:
            new ScaleOutAnimation(card).animate();
            break;
        case 20:
            new ShakeAnimation(card).setNumOfShakes(3).setDuration(Animation.DURATION_SHORT).setListener(new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    mPlayView.setVisibility(View.VISIBLE);
                }
            }).animate();
            break;
        case 21:
            new SlideInAnimation(card).setDirection(Animation.DIRECTION_UP).animate();
            break;
        case 22:
            new SlideInUnderneathAnimation(card).setDirection(Animation.DIRECTION_DOWN).animate();
            break;
        case 23:
            new SlideOutAnimation(card).setDirection(Animation.DIRECTION_LEFT).animate();
            break;
        case 24:
            new SlideOutUnderneathAnimation(card).setDirection(Animation.DIRECTION_RIGHT).animate();
            break;
        case 25:
            new TransferAnimation(card).setDestinationView(target).animate();
            break;
        case 26:
            card.setImageResource(R.drawable.test_back2);
            final AnimationListener explodeAnimListener = new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    card.setVisibility(View.INVISIBLE);
                    mPlayView.setVisibility(View.VISIBLE);
                }
            };
            final AnimationListener bounceAnimListener = new AnimationListener() {

                @Override
                public void onAnimationEnd(Animation animation) {
                    new ExplodeAnimation(card2).setListener(explodeAnimListener).animate();
                }
            };
            final ParallelAnimatorListener slideFadeInAnimListener = new ParallelAnimatorListener() {

                @Override
                public void onAnimationEnd(ParallelAnimator parallelAnimator) {
                    BounceAnimation bounceAnim = new BounceAnimation(card2);
                    bounceAnim.setNumOfBounces(10);
                    bounceAnim.setListener(bounceAnimListener);
                    bounceAnim.animate();
                }
            };
            final ParallelAnimatorListener slideFadeOutAnimListener = new ParallelAnimatorListener() {

                @Override
                public void onAnimationEnd(ParallelAnimator parallelAnimator) {
                    ParallelAnimator slideFadeInAnim = new ParallelAnimator();
                    slideFadeInAnim.add(new SlideInAnimation(card2).setDirection(Animation.DIRECTION_RIGHT));
                    slideFadeInAnim.add(new FadeInAnimation(card2));
                    slideFadeInAnim.setDuration(1000);
                    slideFadeInAnim.setListener(slideFadeInAnimListener);
                    slideFadeInAnim.animate();
                }
            };
            final ParallelAnimatorListener rotatePathAnimListener = new ParallelAnimatorListener() {

                @Override
                public void onAnimationEnd(ParallelAnimator parallelAnimator) {
                    ParallelAnimator slideFadeOutAnim = new ParallelAnimator();
                    slideFadeOutAnim.add(new SlideOutAnimation(card).setDirection(Animation.DIRECTION_RIGHT));
                    slideFadeOutAnim.add(new FadeOutAnimation(card));
                    slideFadeOutAnim.setInterpolator(new LinearInterpolator());
                    slideFadeOutAnim.setDuration(1000);
                    slideFadeOutAnim.setListener(slideFadeOutAnimListener);
                    slideFadeOutAnim.animate();
                }
            };
            final ParallelAnimatorListener scaleFlipAnimListener = new ParallelAnimatorListener() {

                @Override
                public void onAnimationEnd(ParallelAnimator parallelAnimator) {
                    ArrayList<Point> parallelPoints = new ArrayList<>();
                    parallelPoints.add(new Point(50, 0));
                    parallelPoints.add(new Point(100, 50));
                    parallelPoints.add(new Point(50, 100));
                    parallelPoints.add(new Point(0, 50));
                    parallelPoints.add(new Point(50, 50));
                    ParallelAnimator rotatePathAnim = new ParallelAnimator();
                    rotatePathAnim.add(new PathAnimation(card).setPoints(parallelPoints));
                    rotatePathAnim.add(new RotationAnimation(card));
                    rotatePathAnim.setInterpolator(new LinearInterpolator());
                    rotatePathAnim.setDuration(2000);
                    rotatePathAnim.setListener(rotatePathAnimListener);
                    rotatePathAnim.animate();
                }
            };
            ParallelAnimator scaleFlipAnim = new ParallelAnimator();
            scaleFlipAnim.add(new ScaleInAnimation(card));
            scaleFlipAnim.add(new FlipHorizontalAnimation(card));
            scaleFlipAnim.add(new FlipVerticalAnimation(card));
            scaleFlipAnim.setDuration(2000);
            scaleFlipAnim.setListener(scaleFlipAnimListener);
            scaleFlipAnim.animate();
            break;
        default:
            break;
    }
}
Also used : FoldAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FoldAnimation) UnfoldAnimation(com.marshalchen.common.uimodule.easyandroidanimations.UnfoldAnimation) FlipHorizontalAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalAnimation) FadeOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FadeOutAnimation) BounceAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BounceAnimation) ArrayList(java.util.ArrayList) HighlightAnimation(com.marshalchen.common.uimodule.easyandroidanimations.HighlightAnimation) SlideInUnderneathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideInUnderneathAnimation) BlinkAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BlinkAnimation) FlipVerticalToAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalToAnimation) FadeInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FadeInAnimation) FlipHorizontalToAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalToAnimation) ParallelAnimatorListener(com.marshalchen.common.uimodule.easyandroidanimations.ParallelAnimatorListener) ShakeAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ShakeAnimation) RotationAnimation(com.marshalchen.common.uimodule.easyandroidanimations.RotationAnimation) TransferAnimation(com.marshalchen.common.uimodule.easyandroidanimations.TransferAnimation) PathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PathAnimation) Point(android.graphics.Point) BlindAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BlindAnimation) SlideOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideOutAnimation) ExplodeAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ExplodeAnimation) FlipVerticalAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalAnimation) ParallelAnimator(com.marshalchen.common.uimodule.easyandroidanimations.ParallelAnimator) LinearInterpolator(android.view.animation.LinearInterpolator) SlideInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideInAnimation) PuffInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PuffInAnimation) PuffOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PuffOutAnimation) SlideOutUnderneathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideOutUnderneathAnimation) FadeInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FadeInAnimation) FadeOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FadeOutAnimation) ShakeAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ShakeAnimation) SlideInUnderneathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideInUnderneathAnimation) ScaleOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ScaleOutAnimation) UnfoldAnimation(com.marshalchen.common.uimodule.easyandroidanimations.UnfoldAnimation) BounceAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BounceAnimation) HighlightAnimation(com.marshalchen.common.uimodule.easyandroidanimations.HighlightAnimation) RotationAnimation(com.marshalchen.common.uimodule.easyandroidanimations.RotationAnimation) FlipHorizontalAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalAnimation) PuffOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PuffOutAnimation) ScaleInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ScaleInAnimation) BlindAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BlindAnimation) FoldAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FoldAnimation) SlideInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideInAnimation) SlideOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideOutAnimation) PuffInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PuffInAnimation) FlipVerticalAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalAnimation) TransferAnimation(com.marshalchen.common.uimodule.easyandroidanimations.TransferAnimation) FlipVerticalToAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalToAnimation) PathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.PathAnimation) BlinkAnimation(com.marshalchen.common.uimodule.easyandroidanimations.BlinkAnimation) Animation(com.marshalchen.common.uimodule.easyandroidanimations.Animation) ExplodeAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ExplodeAnimation) SlideOutUnderneathAnimation(com.marshalchen.common.uimodule.easyandroidanimations.SlideOutUnderneathAnimation) FlipHorizontalToAnimation(com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalToAnimation) ScaleInAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ScaleInAnimation) AnimationListener(com.marshalchen.common.uimodule.easyandroidanimations.AnimationListener) ScaleOutAnimation(com.marshalchen.common.uimodule.easyandroidanimations.ScaleOutAnimation)

Aggregations

Point (android.graphics.Point)1 LinearInterpolator (android.view.animation.LinearInterpolator)1 Animation (com.marshalchen.common.uimodule.easyandroidanimations.Animation)1 AnimationListener (com.marshalchen.common.uimodule.easyandroidanimations.AnimationListener)1 BlindAnimation (com.marshalchen.common.uimodule.easyandroidanimations.BlindAnimation)1 BlinkAnimation (com.marshalchen.common.uimodule.easyandroidanimations.BlinkAnimation)1 BounceAnimation (com.marshalchen.common.uimodule.easyandroidanimations.BounceAnimation)1 ExplodeAnimation (com.marshalchen.common.uimodule.easyandroidanimations.ExplodeAnimation)1 FadeInAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FadeInAnimation)1 FadeOutAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FadeOutAnimation)1 FlipHorizontalAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalAnimation)1 FlipHorizontalToAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FlipHorizontalToAnimation)1 FlipVerticalAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalAnimation)1 FlipVerticalToAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FlipVerticalToAnimation)1 FoldAnimation (com.marshalchen.common.uimodule.easyandroidanimations.FoldAnimation)1 HighlightAnimation (com.marshalchen.common.uimodule.easyandroidanimations.HighlightAnimation)1 ParallelAnimator (com.marshalchen.common.uimodule.easyandroidanimations.ParallelAnimator)1 ParallelAnimatorListener (com.marshalchen.common.uimodule.easyandroidanimations.ParallelAnimatorListener)1 PathAnimation (com.marshalchen.common.uimodule.easyandroidanimations.PathAnimation)1 PuffInAnimation (com.marshalchen.common.uimodule.easyandroidanimations.PuffInAnimation)1