Example usage for android.view.animation OvershootInterpolator OvershootInterpolator

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

Introduction

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

Prototype

public OvershootInterpolator() 

Source Link

Usage

From source file:Main.java

public static OvershootInterpolator getOvershootInterpolator() {
    return new OvershootInterpolator();
}

From source file:Main.java

public static void onCompare(View v) {
    v.setScaleX(0f);//from ww  w .  j  a v  a  2s  .c o  m
    v.setScaleY(0f);
    v.animate().setInterpolator(new OvershootInterpolator()).scaleX(1).scaleY(1).setDuration(150);
}

From source file:Main.java

public static AnimationSet ShuffleAnimation(int deltaX, int deltaY) {

    TranslateAnimation shake_1 = new TranslateAnimation(0, deltaX, 0, deltaY);
    shake_1.setDuration(400);//from  w  ww  .  j ava2  s .  c  o  m
    shake_1.setStartOffset(0);
    shake_1.setFillAfter(true);
    TranslateAnimation shake_2 = new TranslateAnimation(0, -deltaX, 0, -deltaY);
    shake_2.setDuration(400);
    shake_2.setStartOffset(400);
    shake_2.setFillAfter(true);
    AnimationSet ShakeIt = new AnimationSet(true);
    ShakeIt.addAnimation(shake_1);
    ShakeIt.addAnimation(shake_2);
    ShakeIt.setInterpolator(new OvershootInterpolator());

    return ShakeIt;
}

From source file:com.example.st.animsharedemo.transitions.RecyclerViewAnimators.animators.OvershootInLeftAnimator.java

@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    ViewCompat.animate(holder.itemView).translationX(0).setDuration(getAddDuration())
            .setListener(new DefaultAddVpaListener(holder)).setInterpolator(new OvershootInterpolator())
            .start();//from  w ww . j  a  v  a  2s.c  om
}

From source file:com.hirecraft.controls.mylib.recycleranimations.OvershootInLeftAnimator.java

@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    ViewCompat.animate(holder.itemView).translationX(0).setDuration(getAddDuration())
            .setListener(new DefaultAddVpaListener(holder)).setInterpolator(new OvershootInterpolator())
            .start();//from  w w w  . ja  v a  2 s  .  c o m
    mAddAnimations.add(holder);
}

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

/**
 * Creates interpolator./*from  ww w  .  j  av a  2s . c  om*/
 * @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:nyc.c4q.jordansmith.finefree.FragmentHome.java

@Nullable
@Override//  ww  w .  ja  v a  2  s . c  o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.home_fragment_layout, container, false);
    violationRV = (RecyclerView) rootView.findViewById(R.id.violations_recyclerview);
    nameOfCar = (TextView) rootView.findViewById(R.id.name_textview);
    plateOfCar = (TextView) rootView.findViewById(R.id.license_textview);
    onlyShownIfNoDataTV = (TextView) rootView.findViewById(R.id.replace_rv_when_empty);

    Bundle bundle = getArguments();
    if (bundle != null) {
        Car car = (Car) bundle.getSerializable(ActivityMain.PLATE_KEY);
        licensePlate = car.getLicensePlate();
        plateOfCar.setText("Plate #: " + licensePlate);
        carName = car.getName();
    }

    violationRV.setLayoutManager(new LinearLayoutManager(getContext()));

    AlphaInAnimationAdapter alphaAdapter = new AlphaInAnimationAdapter(mViolationsAdapter);
    alphaAdapter.setDuration(THREE_SECONDS);
    alphaAdapter.setInterpolator(new OvershootInterpolator());
    violationRV.setAdapter(new ScaleInAnimationAdapter(alphaAdapter));
    return rootView;
}

From source file:com.google.android.apps.muzei.util.AnimatedMuzeiLogoFragment.java

@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
    mSubtitleView = view.findViewById(R.id.logo_subtitle);

    mLogoView = (AnimatedMuzeiLogoView) view.findViewById(R.id.animated_logo);
    mLogoView.setOnStateChangeListener(new AnimatedMuzeiLogoView.OnStateChangeListener() {
        @Override//from w  w  w .  j av a2  s  . co m
        public void onStateChange(int state) {
            if (state == AnimatedMuzeiLogoView.STATE_FILL_STARTED) {
                mSubtitleView.setAlpha(0);
                mSubtitleView.setVisibility(View.VISIBLE);
                mSubtitleView.setTranslationY(-mSubtitleView.getHeight());

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

                if (mOnFillStartedCallback != null) {
                    mOnFillStartedCallback.run();
                }
            }
        }
    });
    if (savedInstanceState == null) {
        reset();
    }
}

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

public static Interpolator getOvershootInterpolator() {
    if (overshoot == null) {
        overshoot = new OvershootInterpolator();
    }/*from  w w w .  j a v  a 2s .c om*/
    return overshoot;
}

From source file:com.google.android.apps.muzei.TutorialFragment.java

@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
    view.findViewById(R.id.tutorial_icon_affordance).setOnClickListener(new View.OnClickListener() {
        @Override/*www. j a  va2 s  . com*/
        public void onClick(View view) {
            FirebaseAnalytics.getInstance(getContext()).logEvent(FirebaseAnalytics.Event.TUTORIAL_COMPLETE,
                    null);
            final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
            sp.edit().putBoolean(PREF_SEEN_TUTORIAL, true).apply();
        }
    });

    if (savedInstanceState == null) {
        float animateDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100,
                getResources().getDisplayMetrics());
        View mainTextView = view.findViewById(R.id.tutorial_main_text);
        mainTextView.setAlpha(0);
        mainTextView.setTranslationY(-animateDistance / 5);
        View subTextView = view.findViewById(R.id.tutorial_sub_text);
        subTextView.setAlpha(0);
        subTextView.setTranslationY(-animateDistance / 5);
        final View affordanceView = view.findViewById(R.id.tutorial_icon_affordance);
        affordanceView.setAlpha(0);
        affordanceView.setTranslationY(animateDistance);
        View iconTextView = view.findViewById(R.id.tutorial_icon_text);
        iconTextView.setAlpha(0);
        iconTextView.setTranslationY(animateDistance);
        mAnimator = new AnimatorSet();
        mAnimator.setStartDelay(500);
        mAnimator.setDuration(250);
        mAnimator.playTogether(ObjectAnimator.ofFloat(mainTextView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(subTextView, View.ALPHA, 1f));
        mAnimator.start();
        mAnimator = new AnimatorSet();
        mAnimator.setStartDelay(2000);
        // Bug in older versions where set.setInterpolator didn't work
        Interpolator interpolator = new OvershootInterpolator();
        ObjectAnimator a1 = ObjectAnimator.ofFloat(affordanceView, View.TRANSLATION_Y, 0);
        ObjectAnimator a2 = ObjectAnimator.ofFloat(iconTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a3 = ObjectAnimator.ofFloat(mainTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a4 = ObjectAnimator.ofFloat(subTextView, View.TRANSLATION_Y, 0);
        a1.setInterpolator(interpolator);
        a2.setInterpolator(interpolator);
        a3.setInterpolator(interpolator);
        a4.setInterpolator(interpolator);
        mAnimator.setDuration(500).playTogether(ObjectAnimator.ofFloat(affordanceView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(iconTextView, View.ALPHA, 1f), a1, a2, a3, a4);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (isAdded()) {
                        ImageView emanateView = (ImageView) view.findViewById(R.id.tutorial_icon_emanate);
                        AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources()
                                .getDrawable(R.drawable.avd_tutorial_icon_emanate, getContext().getTheme());
                        emanateView.setImageDrawable(avd);
                        avd.start();
                    }
                }
            });
        }
        mAnimator.start();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ImageView emanateView = (ImageView) view.findViewById(R.id.tutorial_icon_emanate);
        AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources()
                .getDrawable(R.drawable.avd_tutorial_icon_emanate, getContext().getTheme());
        emanateView.setImageDrawable(avd);
        avd.start();
    }
}