Example usage for android.view.animation AnticipateInterpolator AnticipateInterpolator

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

Introduction

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

Prototype

public AnticipateInterpolator() 

Source Link

Usage

From source file:Main.java

public static AnticipateInterpolator getAnticipateInterpolator() {
    return new AnticipateInterpolator();
}

From source file:com.bobomee.android.navigator.expandable.Utils.java

/**
 * Creates interpolator./*from   w  w  w. j  ava  2s .  co m*/
 * @return  a timeinterpolator
 * @param interpolatorType a int value from 0 to 10
 */
public static TimeInterpolator createInterpolator(@IntRange(from = 0, to = 10) final int interpolatorType) {
    switch (interpolatorType) {
    case ACCELERATE_DECELERATE_INTERPOLATOR:
        return new AccelerateDecelerateInterpolator();
    case ACCELERATE_INTERPOLATOR:
        return new AccelerateInterpolator();
    case ANTICIPATE_INTERPOLATOR:
        return new AnticipateInterpolator();
    case ANTICIPATE_OVERSHOOT_INTERPOLATOR:
        return new AnticipateOvershootInterpolator();
    case BOUNCE_INTERPOLATOR:
        return new BounceInterpolator();
    case DECELERATE_INTERPOLATOR:
        return new DecelerateInterpolator();
    case FAST_OUT_LINEAR_IN_INTERPOLATOR:
        return new FastOutLinearInInterpolator();
    case FAST_OUT_SLOW_IN_INTERPOLATOR:
        return new FastOutSlowInInterpolator();
    case LINEAR_INTERPOLATOR:
        return new LinearInterpolator();
    case LINEAR_OUT_SLOW_IN_INTERPOLATOR:
        return new LinearOutSlowInInterpolator();
    case OVERSHOOT_INTERPOLATOR:
        return new OvershootInterpolator();
    default:
        return new LinearInterpolator();
    }
}

From source file:com.savvasdalkitsis.betwixt.Interpolators.java

/**
 * <strong>ANDROID INTERPOLATOR</strong><br/><br/>
 * An interpolator where the change starts backward then flings forward.
 *//*from   w w  w.j a v a  2  s  . co  m*/
@NonNull
public static Interpolator anticipate() {
    return new AnticipateInterpolator();
}

From source file:com.yoloo.android.util.AnimUtils.java

public static Interpolator getAnticipateInterpolator() {
    if (anticipate == null) {
        anticipate = new AnticipateInterpolator();
    }/*ww w.  j  av  a 2 s  .co m*/
    return anticipate;
}

From source file:pl.mg6.android.maps.extensions.demo.AnimateMarkersActivity.java

private Interpolator randomInterpolator() {
    int val = random.nextInt(14);
    switch (val) {
    case 0://from   w ww  .  ja  v  a  2  s. com
        return new LinearInterpolator();
    case 1:
        return new AccelerateDecelerateInterpolator();
    case 2:
        return new AccelerateInterpolator();
    case 3:
        return new AccelerateInterpolator(6.0f);
    case 4:
        return new DecelerateInterpolator();
    case 5:
        return new DecelerateInterpolator(6.0f);
    case 6:
        return new BounceInterpolator();
    case 7:
        return new AnticipateOvershootInterpolator();
    case 8:
        return new AnticipateOvershootInterpolator(6.0f);
    case 9:
        return new AnticipateInterpolator();
    case 10:
        return new AnticipateInterpolator(6.0f);
    case 11:
        return new OvershootInterpolator();
    case 12:
        return new OvershootInterpolator(6.0f);
    case 13:
        return new CycleInterpolator(1.25f);
    }
    throw new RuntimeException();
}

From source file:Steps.StepsFragment.java

/**
 * Once the goal is animate the progress arch back
 * and start "playGoalAnimation2"/*  w  w  w.j a  v a2s  .c o  m*/
 */
private void playGoalAnimation() {
    goalAnimationPlaying = true;
    resetText();
    mDecoView.addEvent(new DecoEvent.Builder(0).setIndex(mSeries1Index).setDuration(1000)
            .setInterpolator(new AnticipateInterpolator()).setListener(new DecoEvent.ExecuteEventListener() {
                @Override
                public void onEventStart(DecoEvent decoEvent) {

                }

                @Override
                public void onEventEnd(DecoEvent decoEvent) {
                    resetText();
                    playGoalAnimation2();

                }
            }).build());

    resetText();
}

From source file:self.philbrown.droidQuery.$.java

/**
 * This reusable chunk of code can set up the given animation using the given animation options
 * @param options the options used to manipulate how the animation behaves
 * @return the container for placing views that will be animated using the given options
 *//*from  www . j a  v a2  s .c  o m*/
private AnimatorSet animationWithOptions(final AnimationOptions options, List<Animator> animators) {
    AnimatorSet animation = new AnimatorSet();
    animation.playTogether(animators);
    animation.setDuration(options.duration());
    animation.addListener(new AnimatorListener() {

        @Override
        public void onAnimationCancel(Animator animation) {
            if (options.fail() != null)
                options.fail().invoke($.this);
            if (options.complete() != null)
                options.complete().invoke($.this);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (options.success() != null)
                options.success().invoke($.this);
            if (options.complete() != null)
                options.complete().invoke($.this);
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationStart(Animator animation) {
        }

    });
    Interpolator interpolator = null;
    if (options.easing() == null)
        options.easing(Easing.LINEAR);
    final Easing easing = options.easing();
    switch (easing) {
    case ACCELERATE: {
        interpolator = new AccelerateInterpolator();
        break;
    }
    case ACCELERATE_DECELERATE: {
        interpolator = new AccelerateDecelerateInterpolator();
        break;
    }
    case ANTICIPATE: {
        interpolator = new AnticipateInterpolator();
        break;
    }
    case ANTICIPATE_OVERSHOOT: {
        interpolator = new AnticipateOvershootInterpolator();
        break;
    }
    case BOUNCE: {
        interpolator = new BounceInterpolator();
        break;
    }
    case DECELERATE: {
        interpolator = new DecelerateInterpolator();
        break;
    }
    case OVERSHOOT: {
        interpolator = new OvershootInterpolator();
        break;
    }
    //linear is default.
    case LINEAR:
    default:
        interpolator = new LinearInterpolator();
        break;
    }

    //allow custom interpolator
    if (options.specialEasing() != null)
        interpolator = options.specialEasing();

    animation.setInterpolator(interpolator);

    return animation;
}

From source file:ac.robinson.paperchains.PaperChainsActivity.java

private void animateRecordingInterface(int direction, View keyView) {
    mPlayButton.setVisibility(View.VISIBLE);
    mDeleteButton.setVisibility(View.VISIBLE);
    mSaveButton.setVisibility(View.VISIBLE);

    // animate the control buttons out to be equally spaced around the record button
    float buttonOffset = -mPlayButton.getWidth();
    PointF centre = new PointF(0, 0);
    PointF startingPoint = new PointF(0, buttonOffset);
    double radRot = Math.toRadians(-120);
    double cosRot = Math.cos(radRot);
    double sinRot = Math.sin(radRot);
    QRImageParser.rotatePoint(startingPoint, centre, cosRot, sinRot);
    float leftX = startingPoint.x;
    float leftY = startingPoint.y;
    QRImageParser.rotatePoint(startingPoint, centre, cosRot, sinRot);
    float rightX = startingPoint.x;
    float rightY = startingPoint.y;

    RelativeLayout parent;//from  w w w .j a  v a2s. c  om
    AnimatorSet buttonAnimator = new AnimatorSet();
    switch (direction) {
    case 1: // out
        // on an outward animation, we want the three minor buttons to have priority so the record button's
        // larger click area doesn't capture their clicks
        mPlayButton.bringToFront();
        mDeleteButton.bringToFront();
        mSaveButton.bringToFront();
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            // need to manually re-layout before KitKat
            parent = (RelativeLayout) mPlayButton.getParent();
            parent.requestLayout();
            parent.invalidate();
        }

        buttonAnimator.playTogether(ObjectAnimator.ofFloat(mDeleteButton, "translationX", 0, leftX),
                ObjectAnimator.ofFloat(mDeleteButton, "translationY", 0, leftY),
                ObjectAnimator.ofFloat(mSaveButton, "translationX", 0, rightX),
                ObjectAnimator.ofFloat(mSaveButton, "translationY", 0, rightY),
                ObjectAnimator.ofFloat(mPlayButton, "translationY", 0, buttonOffset));
        buttonAnimator.setInterpolator(new OvershootInterpolator());
        break;
    case -1: // in
        // keyView is the view we want to be at the front after an inward animation
        if (keyView != null) {
            keyView.bringToFront();
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                // need to manually re-layout before KitKat
                parent = (RelativeLayout) keyView.getParent();
                parent.requestLayout();
                parent.invalidate();
            }
        }

        buttonAnimator.playTogether(ObjectAnimator.ofFloat(mDeleteButton, "translationX", leftX, 0),
                ObjectAnimator.ofFloat(mDeleteButton, "translationY", leftY, 0),
                ObjectAnimator.ofFloat(mSaveButton, "translationX", rightX, 0),
                ObjectAnimator.ofFloat(mSaveButton, "translationY", rightY, 0),
                ObjectAnimator.ofFloat(mPlayButton, "translationY", buttonOffset, 0));
        buttonAnimator.setInterpolator(new AnticipateInterpolator());
        break;
    }
    buttonAnimator.setDuration(BUTTON_ANIMATION_DURATION);
    buttonAnimator.start();
}