Search in sources :

Example 96 with Animator

use of android.animation.Animator in project StarWars.Android by Yalantis.

the class SideFragment method createCheckoutRevealAnimator.

protected Animator createCheckoutRevealAnimator(final ClipRevealFrame view, int x, int y, float startRadius, float endRadius) {
    setMenuVisibility(false);
    Animator retAnimator;
    mRadius = endRadius;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        retAnimator = ViewAnimationUtils.createCircularReveal(view, x, y, startRadius, endRadius);
    } else {
        view.setClipOutLines(true);
        view.setClipCenter(x, y);
        view.setClipRadius(startRadius);
        retAnimator = ObjectAnimator.ofFloat(view, "clipRadius", startRadius, endRadius);
    }
    retAnimator.setDuration(ANIM_DURATION);
    retAnimator.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setClipOutLines(false);
            removeOldSideFragment();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    retAnimator.setInterpolator(new AccelerateInterpolator(2.0f));
    return retAnimator;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator)

Example 97 with Animator

use of android.animation.Animator in project StarWars.Android by Yalantis.

the class StarWarsRenderer method startAnimation.

public void startAnimation() {
    new Handler(Looper.getMainLooper()).post(new Runnable() {

        @Override
        public void run() {
            // plane height
            animator = ValueAnimator.ofFloat(0, -Const.PLANE_HEIGHT * 2);
            animator.setDuration(mAnimationDuration);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    float value = (float) animation.getAnimatedValue();
                    deltaPosX = value;
                    mGlSurfaceView.requestRender();
                }
            });
            animator.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                    mGlSurfaceView.requestRender();
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    mListener.onAnimationFinished();
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
            animator.start();
        }
    });
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) Handler(android.os.Handler) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 98 with Animator

use of android.animation.Animator in project actor-platform by actorapp.

the class AttachFragment method hide.

@Override
public void hide() {
    if (root != null && root.getVisibility() == View.VISIBLE) {
        onHidden();
        fastAttachAdapter.clearSelected();
        messenger().getGalleryScannerActor().send(new GalleryScannerActor.Hide());
        fastShare.scrollToPosition(0);
        hideView(root);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP && !isFastShareFullScreen) {
            View internal = fastShare;
            int cx = internal.getWidth() - Screen.dp(56 + 56);
            int cy = internal.getHeight() - Screen.dp(56 / 2);
            float finalRadius = (float) Math.hypot(cx, cy);
            Animator anim = ViewAnimationUtils.createCircularReveal(internal, cx, cy, finalRadius, 0);
            anim.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animator) {
                    internal.setAlpha(1);
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    internal.setAlpha(0);
                }

                @Override
                public void onAnimationCancel(Animator animator) {
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                }
            });
            anim.setDuration(200);
            anim.start();
        } else {
            TranslateAnimation animation = new TranslateAnimation(0, 0, 0, root.getHeight());
            animation.setInterpolator(MaterialInterpolator.getInstance());
            animation.setDuration(250);
            fastShare.startAnimation(animation);
            bottomBackground.startAnimation(animation);
        }
    }
}
Also used : Animator(android.animation.Animator) TranslateAnimation(android.view.animation.TranslateAnimation) GalleryScannerActor(im.actor.core.utils.GalleryScannerActor) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 99 with Animator

use of android.animation.Animator in project lottie-android by airbnb.

the class AnimationFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_animation, container, false);
    ButterKnife.bind(this, view);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_back);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getFragmentManager().popBackStack();
        }
    });
    postUpdatePlayButtonText();
    onLoopChanged();
    animationView.addAnimatorListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            startRecordingDroppedFrames();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            recordDroppedFrames();
            postUpdatePlayButtonText();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            postUpdatePlayButtonText();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
            recordDroppedFrames();
            startRecordingDroppedFrames();
        }
    });
    animationView.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            seekBar.setProgress((int) (animation.getAnimatedFraction() * 100));
        }
    });
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (!animationView.isAnimating()) {
                animationView.setProgress(progress / 100f);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    return view;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) SeekBar(android.widget.SeekBar) AppCompatSeekBar(android.support.v7.widget.AppCompatSeekBar) AppCompatActivity(android.support.v7.app.AppCompatActivity) ValueAnimator(android.animation.ValueAnimator) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) Nullable(android.support.annotation.Nullable)

Example 100 with Animator

use of android.animation.Animator in project LuaViewSDK by alibaba.

the class UDAnimatorSet method setupValues.

public UDAnimatorSet setupValues(Animator animator) {
    animator.setupStartValues();
    if (mTarget != null && mAnimators != null) {
        for (Animator anim : mAnimators) {
            anim.setTarget(mTarget.getView());
            anim.setupStartValues();
            if (anim instanceof ValueAnimator) {
                ((ValueAnimator) anim).setRepeatCount(mRepeatCount);
                ((ValueAnimator) anim).setRepeatMode(mRepeatMode);
            //TODO
            }
        }
        if (animator instanceof AnimatorSet) {
            ((AnimatorSet) animator).playTogether(mAnimators);
        }
    }
    return this;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator)

Aggregations

Animator (android.animation.Animator)1384 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)848 ObjectAnimator (android.animation.ObjectAnimator)712 ValueAnimator (android.animation.ValueAnimator)627 AnimatorSet (android.animation.AnimatorSet)278 View (android.view.View)227 ViewGroup (android.view.ViewGroup)110 ArrayList (java.util.ArrayList)101 PropertyValuesHolder (android.animation.PropertyValuesHolder)94 Paint (android.graphics.Paint)78 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)75 ImageView (android.widget.ImageView)68 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)66 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)65 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)61 TextView (android.widget.TextView)60 RenderNodeAnimator (android.view.RenderNodeAnimator)51 ViewPropertyAnimator (android.view.ViewPropertyAnimator)50 Rect (android.graphics.Rect)49 Interpolator (android.view.animation.Interpolator)49