Example usage for android.animation ObjectAnimator setInterpolator

List of usage examples for android.animation ObjectAnimator setInterpolator

Introduction

In this page you can find the example usage for android.animation ObjectAnimator setInterpolator.

Prototype

@Override
public void setInterpolator(TimeInterpolator value) 

Source Link

Document

The time interpolator used in calculating the elapsed fraction of this animation.

Usage

From source file:com.android.tabletcustomui.views.LeftCircleContainer.java

private void animateClockWise(View view) {
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotation", 0.0f, 360f);
    animation.setDuration(3000);/*from   ww  w.  j a v a 2  s  .  c om*/
    animation.setInterpolator(new FastOutSlowInInterpolator());
    animation.start();
}

From source file:com.android.tabletcustomui.views.LeftCircleContainer.java

private void animateAntiClockWise(View view) {
    ObjectAnimator animation1 = ObjectAnimator.ofFloat(view, "rotation", 360f, 0.0f);
    animation1.setDuration(3000);/*from   w w w  .  j a  v  a  2 s . co  m*/
    animation1.setInterpolator(new FastOutSlowInInterpolator());
    animation1.start();
}

From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java

public void animateToBack() {
    ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 0f, 1f);
    backAnim.setDuration(500);/* w  ww .  jav  a  2s  .  c om*/
    backAnim.setInterpolator(LINEAR_INTERPOLATOR);
    backAnim.start();
}

From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java

public void animateToMain() {
    ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 1f, 0f);
    backAnim.setDuration(500);/*from   w  w w .ja v a2 s  . c  o m*/
    backAnim.setInterpolator(LINEAR_INTERPOLATOR);
    backAnim.start();
}

From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java

public void animateToMain(final Animator.AnimatorListener animatorListener) {
    ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 1f, 0f);
    backAnim.setDuration(500);//from   w w w. j a va2 s . c  om
    backAnim.setInterpolator(LINEAR_INTERPOLATOR);
    backAnim.addListener(animatorListener);
    backAnim.start();
}

From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java

public void drawFail() {
    mState = State.STATE_FAILED;/*ww w .  j  a v  a 2  s . c  o m*/

    ObjectAnimator failAnim = ObjectAnimator.ofFloat(this, "failAngle", 0, 180);
    failAnim.setInterpolator(new OvershootInterpolator());

    //This one doesn't do much actually, we just use it to take advantage of associating two different interpolators
    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new AccelerateInterpolator());

    AnimatorSet set = new AnimatorSet();
    set.setDuration((long) (ANIMATION_DURATION_BASE / 1.7f));
    set.playTogether(failAnim, anim);
    set.start();
}

From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java

public void setPercentage(float newProgress) {
    if (newProgress < 0 || newProgress > 100) {
        throw new IllegalArgumentException("setPercentage not between 0 and 100");
    }//  ww  w .  jav a 2  s  .c  o m

    mState = State.STATE_WORKING;
    mTarget = newProgress;

    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new DecelerateInterpolator());
    anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2));
    anim.start();
}

From source file:com.cuelogic.android.WheelIndicatorView.java

public void startItemsAnimation() {
    ObjectAnimator animation = ObjectAnimator.ofInt(WheelIndicatorView.this, "filledPercent", 0, filledPercent);
    animation.setDuration(ANIMATION_DURATION);
    animation.setInterpolator(PathInterpolatorCompat.create(0.4F, 0.0F, 0.2F, 1.0F));
    animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override//w  w  w  .j a  va2  s . c o  m
        public void onAnimationUpdate(ValueAnimator animation) {
            recalculateItemsAngles();
            invalidate();
        }
    });
    animation.start();
}

From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java

public void drawSuccess() {
    mTarget = 100;// ww  w .  j  av a 2 s  .c  o m

    final ObjectAnimator successAnim = ObjectAnimator.ofFloat(this, "flip", 1, -1);
    successAnim.setInterpolator(new OvershootInterpolator());
    successAnim.setDuration(ANIMATION_DURATION_BASE);

    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new DecelerateInterpolator());
    anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2));
    anim.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mState = State.STATE_SUCCESS;
            successAnim.start();
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
    anim.start();
}

From source file:cn.njmeter.njmeter.widget.spinner.NiceSpinner.java

private void animateArrow(boolean shouldRotateUp) {
    int start = shouldRotateUp ? 0 : MAX_LEVEL;
    int end = shouldRotateUp ? MAX_LEVEL : 0;
    ObjectAnimator animator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.start();/*w  ww. j a va 2 s. co m*/
}