Search in sources :

Example 1 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project android-topeka by googlesamples.

the class QuizFragment method setAvatarDrawable.

@SuppressWarnings("ConstantConditions")
private void setAvatarDrawable(AvatarView avatarView) {
    Player player = PreferencesHelper.getPlayer(getActivity());
    avatarView.setAvatar(player.getAvatar().getDrawableId());
    ViewCompat.animate(avatarView).setInterpolator(new FastOutLinearInInterpolator()).setStartDelay(500).scaleX(1).scaleY(1).start();
}
Also used : Player(com.google.samples.apps.topeka.model.Player) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator)

Example 2 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project android-topeka by googlesamples.

the class QuizActivity method prepareCircularReveal.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void prepareCircularReveal(View startView, FrameLayout targetView) {
    int centerX = (startView.getLeft() + startView.getRight()) / 2;
    // Subtract the start view's height to adjust for relative coordinates on screen.
    int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight();
    float endRadius = (float) Math.hypot(centerX, centerY);
    mCircularReveal = ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, startView.getWidth(), endRadius);
    mCircularReveal.setInterpolator(new FastOutLinearInInterpolator());
    mCircularReveal.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mIcon.setVisibility(View.GONE);
            mCircularReveal.removeListener(this);
        }
    });
    // Adding a color animation from the FAB's color to transparent creates a dissolve like
    // effect to the circular reveal.
    int accentColor = ContextCompat.getColor(this, mCategory.getTheme().getAccentColor());
    mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, accentColor, Color.TRANSPARENT);
    mColorChange.setEvaluator(new ArgbEvaluator());
    mColorChange.setInterpolator(mInterpolator);
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ViewPropertyAnimatorListenerAdapter(android.support.v4.view.ViewPropertyAnimatorListenerAdapter) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) SuppressLint(android.annotation.SuppressLint) TargetApi(android.annotation.TargetApi)

Example 3 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project RxTools by vondear.

the class RxSwipeCaptcha method createMatchAnim.

// 验证动画初始化区域
private void createMatchAnim() {
    mFailAnim = ValueAnimator.ofFloat(0, 1);
    mFailAnim.setDuration(100).setRepeatCount(4);
    mFailAnim.setRepeatMode(ValueAnimator.REVERSE);
    // 失败的时候先闪一闪动画 斗鱼是 隐藏-显示 -隐藏 -显示
    mFailAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            onCaptchaMatchCallback.matchFailed(RxSwipeCaptcha.this);
        }
    });
    mFailAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float animatedValue = (float) animation.getAnimatedValue();
            Log.d(TAG, "onAnimationUpdate: " + animatedValue);
            if (animatedValue < 0.5f) {
                isDrawMask = false;
            } else {
                isDrawMask = true;
            }
            invalidate();
        }
    });
    int width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
    mSuccessAnim = ValueAnimator.ofInt(mWidth + width, 0);
    mSuccessAnim.setDuration(500);
    mSuccessAnim.setInterpolator(new FastOutLinearInInterpolator());
    mSuccessAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mSuccessAnimOffset = (int) animation.getAnimatedValue();
            invalidate();
        }
    });
    mSuccessAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            isShowSuccessAnim = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            onCaptchaMatchCallback.matchSuccess(RxSwipeCaptcha.this);
            isShowSuccessAnim = false;
            isMatchMode = false;
        }
    });
    mSuccessPaint = new Paint();
    mSuccessPaint.setShader(new LinearGradient(0, 0, width / 2 * 3, mHeight, new int[] { 0x00ffffff, 0x88ffffff }, new float[] { 0, 0.5f }, Shader.TileMode.MIRROR));
    // 模仿斗鱼 是一个平行四边形滚动过去
    mSuccessPath = new Path();
    mSuccessPath.moveTo(0, 0);
    mSuccessPath.rLineTo(width, 0);
    mSuccessPath.rLineTo(width / 2, mHeight);
    mSuccessPath.rLineTo(-width, 0);
    mSuccessPath.close();
}
Also used : Path(android.graphics.Path) LinearGradient(android.graphics.LinearGradient) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Paint(android.graphics.Paint) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Example 4 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project LabDayApp by jakdor.

the class MainFragment method animateMenuItems.

/**
 * Animate logo and menu cards
 */
public void animateMenuItems() {
    Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.main_logo_anim);
    animation.setInterpolator(new FastOutLinearInInterpolator());
    animation.start();
    binding.menuLogo.startAnimation(animation);
    View[] menuItems = { binding.menuTimetable.getRoot(), binding.menuMap.getRoot(), binding.menuMedia.getRoot(), binding.menuInfo.getRoot() };
    for (View view : menuItems) {
        view.setTranslationY(50.0f);
        view.setScaleX(0.75f);
        view.setScaleY(0.75f);
        view.setAlpha(0.0f);
    }
    animationHandler.postDelayed(getNextAnimator(menuItems, 0), 100);
}
Also used : FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Animation(android.view.animation.Animation) View(android.view.View)

Example 5 with FastOutLinearInInterpolator

use of android.support.v4.view.animation.FastOutLinearInInterpolator in project weiui by kuaifan.

the class SwipeCaptchaView method createMatchAnim.

// 验证动画初始化区域
private void createMatchAnim() {
    mFailAnim = ValueAnimator.ofFloat(0, 1);
    mFailAnim.setDuration(100).setRepeatCount(4);
    mFailAnim.setRepeatMode(ValueAnimator.REVERSE);
    // 失败的时候先闪一闪动画 斗鱼是 隐藏-显示 -隐藏 -显示
    mFailAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            onCaptchaMatchCallback.matchFailed(SwipeCaptchaView.this);
        }
    });
    mFailAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float animatedValue = (float) animation.getAnimatedValue();
            // Log.d(TAG, "onAnimationUpdate: " + animatedValue);
            if (animatedValue < 0.5f) {
                isDrawMask = false;
            } else {
                isDrawMask = true;
            }
            invalidate();
        }
    });
    int width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
    mSuccessAnim = ValueAnimator.ofInt(mWidth + width, 0);
    mSuccessAnim.setDuration(500);
    mSuccessAnim.setInterpolator(new FastOutLinearInInterpolator());
    mSuccessAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mSuccessAnimOffset = (int) animation.getAnimatedValue();
            invalidate();
        }
    });
    mSuccessAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            isShowSuccessAnim = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            onCaptchaMatchCallback.matchSuccess(SwipeCaptchaView.this);
            isShowSuccessAnim = false;
            isMatchMode = false;
        }
    });
    mSuccessPaint = new Paint();
    mSuccessPaint.setShader(new LinearGradient(0, 0, width / 2 * 3, mHeight, new int[] { 0x00ffffff, 0x88ffffff }, new float[] { 0, 0.5f }, Shader.TileMode.MIRROR));
    // 模仿斗鱼 是一个平行四边形滚动过去
    mSuccessPath = new Path();
    mSuccessPath.moveTo(0, 0);
    mSuccessPath.rLineTo(width, 0);
    mSuccessPath.rLineTo(width / 2, mHeight);
    mSuccessPath.rLineTo(-width, 0);
    mSuccessPath.close();
}
Also used : Path(android.graphics.Path) LinearGradient(android.graphics.LinearGradient) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) Paint(android.graphics.Paint) ValueAnimator(android.animation.ValueAnimator) Paint(android.graphics.Paint)

Aggregations

FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)20 View (android.view.View)10 Animator (android.animation.Animator)7 ValueAnimator (android.animation.ValueAnimator)7 TextView (android.widget.TextView)7 ObjectAnimator (android.animation.ObjectAnimator)6 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)6 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 Interpolator (android.view.animation.Interpolator)4 AnimatorSet (android.animation.AnimatorSet)3 Intent (android.content.Intent)3 Paint (android.graphics.Paint)3 ViewPropertyAnimatorListenerAdapter (android.support.v4.view.ViewPropertyAnimatorListenerAdapter)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 TargetApi (android.annotation.TargetApi)2 LinearGradient (android.graphics.LinearGradient)2 Path (android.graphics.Path)2 Point (android.graphics.Point)2 Bundle (android.os.Bundle)2 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)2