Search in sources :

Example 16 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project ENViews by codeestX.

the class ENPlayView method play.

public void play() {
    if (mCurrentState == STATE_PLAY) {
        return;
    }
    mCurrentState = STATE_PLAY;
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    valueAnimator.setDuration(mDuration);
    valueAnimator.setInterpolator(new AnticipateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = 1 - valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    if (!valueAnimator.isRunning()) {
        valueAnimator.start();
    }
}
Also used : ValueAnimator(android.animation.ValueAnimator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 17 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project Signal-Android by WhisperSystems.

the class VerifyDisplayFragment method animateVerified.

private void animateVerified() {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1, 0, 1, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setInterpolator(new FastOutSlowInInterpolator());
    scaleAnimation.setDuration(800);
    scaleAnimation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            qrVerified.postDelayed(() -> {
                ScaleAnimation scaleAnimation1 = new ScaleAnimation(1, 0, 1, 0, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
                scaleAnimation1.setInterpolator(new AnticipateInterpolator());
                scaleAnimation1.setDuration(500);
                ViewUtil.animateOut(qrVerified, scaleAnimation1, View.GONE);
                ViewUtil.fadeIn(qrCode, 800);
                qrCodeContainer.setEnabled(true);
                tapLabel.setText(getString(R.string.verify_display_fragment__tap_to_scan));
            }, 2000);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    ViewUtil.fadeOut(qrCode, 200, View.INVISIBLE);
    ViewUtil.animateIn(qrVerified, scaleAnimation);
    qrCodeContainer.setEnabled(false);
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Aggregations

AnticipateInterpolator (android.view.animation.AnticipateInterpolator)17 OvershootInterpolator (android.view.animation.OvershootInterpolator)8 ObjectAnimator (android.animation.ObjectAnimator)6 ValueAnimator (android.animation.ValueAnimator)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)4 BounceInterpolator (android.view.animation.BounceInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 LinearInterpolator (android.view.animation.LinearInterpolator)4 TypedArray (android.content.res.TypedArray)3 ContextThemeWrapper (android.view.ContextThemeWrapper)3 Animation (android.view.animation.Animation)2 ScaleAnimation (android.view.animation.ScaleAnimation)2 AccountManagerCallback (android.accounts.AccountManagerCallback)1 AccountManagerFuture (android.accounts.AccountManagerFuture)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 Bundle (android.os.Bundle)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1