Example usage for android.view.animation AccelerateInterpolator AccelerateInterpolator

List of usage examples for android.view.animation AccelerateInterpolator AccelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateInterpolator AccelerateInterpolator.

Prototype

public AccelerateInterpolator() 

Source Link

Usage

From source file:com.github.rubensousa.stackview.animator.StackDefaultAnimator.java

@Override
public void animateChange(View view, final int stackPosition) {
    ViewCompat.animate(view)//  ww  w  . j  a  v  a 2s .c  o  m
            .scaleX(1 - stackPosition * getStackView().getScaleXFactor() < StackView.SCALE_X_MIN
                    ? StackView.SCALE_X_MIN
                    : 1 - stackPosition * getStackView().getScaleXFactor())
            .translationX(stackPosition * getStackView().getHorizontalSpacing())
            .translationZ((getStackView().getSize() - 1 - stackPosition) * getStackView().getElevationSpacing())
            .setStartDelay(stackPosition * 50).setInterpolator(new AccelerateInterpolator())
            .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);
                    ViewCompat.animate(view).setListener(null);
                    getAnimationListener().onChangeFinished(view, stackPosition);
                }
            });

    ViewCompat.animate(view).translationY(stackPosition * getStackView().getVerticalSpacing())
            .setInterpolator(new OvershootInterpolator(3f)).setDuration(getAnimationDuration());
}

From source file:org.ayo.robot.anim.transitioneverywhere.InterpolatorDurationStartDelaySample.java

@Nullable
@Override/*w w w . ja va2 s  .com*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_interpolator, container, false);

    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final View button = transitionsContainer.findViewById(R.id.button);

    button.setOnClickListener(new View.OnClickListener() {

        boolean mToRightAnimation;

        @Override
        public void onClick(View v) {
            mToRightAnimation = !mToRightAnimation;

            Transition transition = new ChangeBounds();
            transition.setDuration(mToRightAnimation ? 700 : 300);
            transition.setInterpolator(
                    mToRightAnimation ? new FastOutSlowInInterpolator() : new AccelerateInterpolator());
            transition.setStartDelay(mToRightAnimation ? 0 : 500);
            TransitionManager.beginDelayedTransition(transitionsContainer, transition);

            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
            params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.TOP) : (Gravity.LEFT | Gravity.TOP);
            button.setLayoutParams(params);
        }

    });

    return view;
}

From source file:com.xujun.contralayout.utils.AnimatorUtil.java

public static void showHeight(final View view, float start, float end) {
    final ValueAnimator animator = ValueAnimator.ofFloat(start, end);
    final ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override/* ww w. j a va 2 s .  c om*/
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float value = (Float) animator.getAnimatedValue();
            layoutParams.height = (int) value;
            view.setLayoutParams(layoutParams);
            Log.i(TAG, "onAnimationUpdate: value=" + value);

        }
    });
    animator.setDuration(500);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.start();
}

From source file:com.srinath.hcfab.under25hack.media.MediaFragment.java

public void onFabPressed(View view) {
    final float startX = mFab.getX();

    AnimatorPath path = new AnimatorPath();
    path.moveTo(0, 0);/*from  ww w  .  j  a v  a  2s  .  c  o  m*/
    path.curveTo(-200, 200, -400, 100, -600, 50);

    final ObjectAnimator anim = ObjectAnimator.ofObject(this, "fabLoc", new PathEvaluator(),
            path.getPoints().toArray());

    anim.setInterpolator(new AccelerateInterpolator());
    anim.setDuration(ANIMATION_DURATION);
    anim.start();

    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (Math.abs(startX - mFab.getX()) > MINIMUN_X_DISTANCE) {
                if (!mRevealFlag) {
                    mFabContainer.setY(mFabContainer.getY() + mFabSize / 2);

                    mFab.animate().scaleXBy(SCALE_FACTOR).scaleYBy(SCALE_FACTOR).setListener(mEndRevealListener)
                            .setDuration(ANIMATION_DURATION);

                    mRevealFlag = true;
                }
            }
        }
    });
}

From source file:com.example.toolbardemo.Fragment.CircularRevealFragment.java

/**
 * {@inheritDoc}//  w ww . jav  a2  s  . co m
 * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle)
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    tv1 = (TextView) getActivity().findViewById(R.id.textView1);
    tv2 = (TextView) getActivity().findViewById(R.id.textView2);
    tv3 = (TextView) getActivity().findViewById(R.id.textView3);
    tv4 = (TextView) getActivity().findViewById(R.id.textView4);
    tv1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv1, tv1.getWidth() / 2,
                    tv1.getHeight() / 2, tv1.getWidth(), 0);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv2, 0, 0, 0,
                    (float) Math.hypot(tv2.getWidth(), tv2.getHeight()));
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv3, tv3.getWidth() / 2,
                    tv3.getHeight() / 2, 0, tv3.getWidth());
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
    tv4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Animator animator = ViewAnimationUtils.createCircularReveal(tv4, 0, 0,
                    (float) Math.hypot(tv4.getWidth(), tv4.getHeight()), 0);
            animator.setInterpolator(new AccelerateInterpolator());
            animator.setDuration(1000);
            animator.start();
        }
    });
}

From source file:oak.demo.svg.AnimatedWtaLogoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_animated_wta_logo, container, false);
    mSubtitleView = mRootView.findViewById(R.id.logo_subtitle);

    mLogoView = (AnimatedSvgView) mRootView.findViewById(R.id.animated_logo);
    mLogoView.setOnStateChangeListener(new AnimatedSvgView.OnStateChangeListener() {
        @Override// w w w . j a  v a 2s .c o  m
        public void onStateChange(int state) {
            if (state == AnimatedSvgView.STATE_FILL_STARTED) {
                ViewHelper.setAlpha(mSubtitleView, 0);
                mSubtitleView.setVisibility(View.VISIBLE);
                //mSubtitleView.setTranslationX(-mSubtitleView.getWidth());

                // Bug in older versions where set.setInterpolator didn't work
                AnimatorSet set = new AnimatorSet();
                Interpolator interpolator = new AccelerateInterpolator();
                ObjectAnimator a1 = ObjectAnimator.ofFloat(mLogoView, "translationX", 0);
                ObjectAnimator a2 = ObjectAnimator.ofFloat(mSubtitleView, "translationX", 0);
                ObjectAnimator a3 = ObjectAnimator.ofFloat(mSubtitleView, "alpha", 1);
                a1.setInterpolator(interpolator);
                a2.setInterpolator(interpolator);
                set.setDuration(500).playTogether(a1, a2, a3);
                set.start();

                if (mOnFillStartedCallback != null) {
                    mOnFillStartedCallback.run();
                }
            }
        }
    });
    mLogoView.setGlyphStrings(WtaLogoPaths.CIRCLE_ONLY_GLYPHS);
    int tc = Color.argb(255, 0, 0, 0);
    int rc = Color.argb(50, 0, 0, 0);
    int[] fillAlphas = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    int[] fillReds = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    int[] fillGreens = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    int[] fillBlues = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    int[] traceColors = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    int[] residueColors = new int[WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length];
    for (int i = 0; i < WtaLogoPaths.CIRCLE_ONLY_GLYPHS.length; i++) {
        fillAlphas[i] = 255;
        fillReds[i] = 136;
        fillGreens[i] = 194;
        fillBlues[i] = 200;
        traceColors[i] = tc;
        residueColors[i] = rc;
    }
    mLogoView.setFillPaints(fillAlphas, fillReds, fillGreens, fillBlues);
    mLogoView.setTraceColors(traceColors);
    mLogoView.setTraceResidueColors(residueColors);
    return mRootView;
}

From source file:com.shizhefei.view.coolrefreshview.header.JellyHeader.java

public JellyHeader(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setWillNotDraw(false);/*from w  ww .j  a  v a  2 s.  c  o m*/

    defaultMinHeight = Utils.dipToPix(context, 208);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.FILL);

    mPath = new Path();

    showLoadingAnimation = new AlphaAnimation(0, 1);
    showLoadingAnimation.setDuration(300);
    showLoadingAnimation.setInterpolator(new AccelerateInterpolator());

    hideLoadingAnimation = new AlphaAnimation(1, 0);
    hideLoadingAnimation.setDuration(300);
    hideLoadingAnimation.setInterpolator(new DecelerateInterpolator());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mViewOutlineProvider = new ViewOutlineProvider() {
            @TargetApi(Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void getOutline(View view, Outline outline) {
                if (mPath.isConvex())
                    outline.setConvexPath(mPath);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
                    outline.offset(0, totalDistance() - currentDistance);
                }
            }
        };
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setElevation(Utils.dipToPix(context, 4));
        }
    }
}

From source file:Main.java

public static Animation getFadeOutAnimation(int durationInMilliseconds) {
    Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setFillAfter(true);//from   w w  w  . j a v a2 s .  c  o  m
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(durationInMilliseconds);
    return fadeOut;
}

From source file:com.github.rubensousa.stackview.animator.StackDefaultAnimator.java

@Override
public void animatePop(Object item, View view) {
    ViewCompat.animate(view).translationX(-view.getWidth() * 1.4f).translationY(view.getHeight() * 0.1f)
            .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setDuration(getAnimationDuration())
            .rotation(-25).setInterpolator(new AccelerateInterpolator())
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override//  w  w  w  . j a  va 2  s  .com
                public void onAnimationEnd(View view) {
                    super.onAnimationEnd(view);
                    ViewCompat.animate(view).setListener(null);
                    getAnimationListener().onExitFinished(view);
                }
            });
}

From source file:com.ridhofkr.hanacaraka.LetterCardActivity.java

private void applyRotation(float start, float end, LinearLayout front, LinearLayout back, boolean flag) {
    final float centerX = front.getWidth() / 2.0f;
    final float centerY = front.getHeight() / 2.0f;

    final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end, centerX, centerY, 310.0f, true);
    rotation.setDuration(300);//from  w w  w.j  a v  a 2  s  . co m
    rotation.setFillAfter(true);
    rotation.setInterpolator(new AccelerateInterpolator());
    rotation.setAnimationListener(new DisplayNextView(flag, front, back));

    LinearLayout inside = (LinearLayout) back.findViewById(R.id.backcardinside);
    if (flag) {
        String text = ((String) ((TextView) front.findViewById(R.id.cardinfotitle)).getText());
        front.startAnimation(rotation);
        removeSoundListener(front);
        inside.addView(ctrl.playAnimation(LetterCardActivity.this, text, category));
    } else {
        back.startAnimation(rotation);
        addSoundListener(front);
        inside.removeViewAt(2);
    }
}