Search in sources :

Example 11 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project FlyRefresh by race604.

the class SampleItemAnimator method animateAddImpl.

@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    View target = holder.itemView;
    View icon = target.findViewById(R.id.icon);
    Animator swing = ObjectAnimator.ofFloat(icon, "rotationX", 45, 0);
    swing.setInterpolator(new OvershootInterpolator(5));
    View right = holder.itemView.findViewById(R.id.right);
    Animator rotateIn = ObjectAnimator.ofFloat(right, "rotationY", 90, 0);
    rotateIn.setInterpolator(new DecelerateInterpolator());
    AnimatorSet animator = new AnimatorSet();
    animator.setDuration(getAddDuration());
    animator.playTogether(swing, rotateIn);
    animator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) BaseItemAnimator(jp.wasabeef.recyclerview.animators.BaseItemAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorSet(android.animation.AnimatorSet) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 12 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project cw-omnibus by commonsguy.

the class AsyncDemoFragment method changeMenuIconAnimation.

// based on https://goo.gl/3IUM8K
private void changeMenuIconAnimation(final FloatingActionMenu menu) {
    AnimatorSet set = new AnimatorSet();
    final ImageView v = menu.getMenuIconView();
    ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(v, "scaleX", 1.0f, 0.2f);
    ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(v, "scaleY", 1.0f, 0.2f);
    ObjectAnimator scaleInX = ObjectAnimator.ofFloat(v, "scaleX", 0.2f, 1.0f);
    ObjectAnimator scaleInY = ObjectAnimator.ofFloat(v, "scaleY", 0.2f, 1.0f);
    scaleOutX.setDuration(50);
    scaleOutY.setDuration(50);
    scaleInX.setDuration(150);
    scaleInY.setDuration(150);
    scaleInX.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            v.setImageResource(menu.isOpened() ? R.drawable.ic_action_settings : R.drawable.ic_close);
        }
    });
    set.play(scaleOutX).with(scaleOutY);
    set.play(scaleInX).with(scaleInY).after(scaleOutX);
    set.setInterpolator(new OvershootInterpolator(2));
    menu.setIconToggleAnimatorSet(set);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 13 with OvershootInterpolator

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

the class ENDownloadView method endAnim.

private void endAnim() {
    ValueAnimator endAnim = ValueAnimator.ofFloat(1.f, 100.f);
    endAnim.setDuration(700);
    endAnim.setInterpolator(new OvershootInterpolator());
    endAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    endAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mFraction = 0;
            mCurrentState = STATE_RESET;
            if (onDownloadStateListener != null) {
                onDownloadStateListener.onDownloadFinish();
            }
        }
    });
    endAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 14 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project KJFrameForAndroid by kymjs.

the class KJAnimations method openAnimation.

/**
     * 打开的动画
     * 
     * @param relativeLayout
     *            子菜单容器
     * @param background
     *            子菜单背景
     * @param menu
     *            菜单按钮
     * @param durationMillis
     *            动画时间
     */
public static void openAnimation(RelativeLayout relativeLayout, ImageView menu, long durationMillis) {
    relativeLayout.setVisibility(View.VISIBLE);
    for (int i = 1; i < relativeLayout.getChildCount(); i++) {
        ImageView imageView = null;
        if (relativeLayout.getChildAt(i) instanceof ImageView) {
            imageView = (ImageView) relativeLayout.getChildAt(i);
        } else {
            continue;
        }
        AnimationSet set = new AnimationSet(true);
        set.addAnimation(getRotateAnimation(-360, 0, durationMillis));
        set.addAnimation(getAlphaAnimation(0.5f, 1.0f, durationMillis));
        set.addAnimation(getTranslateAnimation(menu.getLeft() - imageView.getLeft(), 0, menu.getTop() - imageView.getTop(), 0, durationMillis));
        set.setFillAfter(true);
        set.setDuration(durationMillis);
        set.setStartOffset((i * 100) / (-1 + relativeLayout.getChildCount()));
        set.setInterpolator(new OvershootInterpolator(1f));
        imageView.startAnimation(set);
    }
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet)

Example 15 with OvershootInterpolator

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

the class AttachmentTypeSelector method animateButtonIn.

private void animateButtonIn(View button, int delay) {
    AnimationSet animation = new AnimationSet(true);
    Animation scale = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);
    animation.addAnimation(scale);
    animation.setInterpolator(new OvershootInterpolator(1));
    animation.setDuration(ANIMATION_DURATION);
    animation.setStartOffset(delay);
    button.startAnimation(animation);
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Aggregations

OvershootInterpolator (android.view.animation.OvershootInterpolator)85 ObjectAnimator (android.animation.ObjectAnimator)32 Animator (android.animation.Animator)21 View (android.view.View)21 AnimatorSet (android.animation.AnimatorSet)15 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)14 TextView (android.widget.TextView)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)13 Handler (android.os.Handler)12 ValueAnimator (android.animation.ValueAnimator)10 LinearInterpolator (android.view.animation.LinearInterpolator)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)7 LayerDrawable (android.graphics.drawable.LayerDrawable)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)5 Rect (android.graphics.Rect)5 Interpolator (android.view.animation.Interpolator)5 Point (android.graphics.Point)4