Search in sources :

Example 51 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project NewPipe by TeamNewPipe.

the class AnimationUtils method animateRotation.

public static void animateRotation(final View view, long duration, int targetRotation) {
    if (DEBUG) {
        Log.d(TAG, "animateRotation: duration = [" + duration + "], from " + view.getRotation() + " to → " + targetRotation + " in: " + view);
    }
    view.animate().setListener(null).cancel();
    view.animate().rotation(targetRotation).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationCancel(Animator animation) {
            view.setRotation(targetRotation);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            view.setRotation(targetRotation);
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator)

Example 52 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project androidApp by InspectorIncognito.

the class MapboxUtil method createZoomAnimator.

private static Animator createZoomAnimator(double currentZoom, double targetZoom, final MapboxMap mapboxMap) {
    ValueAnimator zoomAnimator = ValueAnimator.ofFloat((float) currentZoom, (float) targetZoom);
    zoomAnimator.setDuration(CAMERA_ANIMATION_TIME);
    zoomAnimator.setInterpolator(new FastOutSlowInInterpolator());
    zoomAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mapboxMap.setZoom((Float) animation.getAnimatedValue());
        }
    });
    return zoomAnimator;
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 53 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project androidApp by InspectorIncognito.

the class MapboxUtil method createLatLngAnimator.

private static Animator createLatLngAnimator(LatLng currentPosition, LatLng targetPosition, final MapboxMap mapboxMap) {
    ValueAnimator latLngAnimator = ValueAnimator.ofObject(new LatLngEvaluator(), currentPosition, targetPosition);
    latLngAnimator.setDuration(CAMERA_ANIMATION_TIME);
    latLngAnimator.setInterpolator(new FastOutSlowInInterpolator());
    latLngAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mapboxMap.setLatLng((LatLng) animation.getAnimatedValue());
        }
    });
    return latLngAnimator;
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) ILatLng(com.mapbox.mapboxsdk.geometry.ILatLng) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) ValueAnimator(android.animation.ValueAnimator)

Example 54 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project android_packages_apps_Dialer by LineageOS.

the class FlingUpDownMethod method startSwipeToAnswerEntryAnimation.

private void startSwipeToAnswerEntryAnimation() {
    LogUtil.i("FlingUpDownMethod.startSwipeToAnswerEntryAnimation", "Swipe entry animation.");
    endAnimation();
    lockEntryAnim = new AnimatorSet();
    Animator textUp = ObjectAnimator.ofFloat(swipeToAnswerText, View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), 192), DpUtil.dpToPx(getContext(), -20));
    textUp.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    textUp.setInterpolator(new LinearOutSlowInInterpolator());
    Animator textDown = ObjectAnimator.ofFloat(swipeToAnswerText, View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), -20), /* dp */
    0);
    textDown.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    textUp.setInterpolator(new FastOutSlowInInterpolator());
    // "Swipe down to reject" text fades in with a slight translation
    swipeToRejectText.setAlpha(0f);
    Animator rejectTextShow = ObjectAnimator.ofPropertyValuesHolder(swipeToRejectText, PropertyValuesHolder.ofFloat(View.ALPHA, 1f), PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), HINT_REJECT_FADE_TRANSLATION_Y_DP), 0f));
    rejectTextShow.setInterpolator(new FastOutLinearInInterpolator());
    rejectTextShow.setDuration(ANIMATE_DURATION_SHORT_MILLIS);
    rejectTextShow.setStartDelay(SWIPE_TO_DECLINE_FADE_IN_DELAY_MILLIS);
    Animator puckUp = ObjectAnimator.ofFloat(contactPuckContainer, View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), 400), DpUtil.dpToPx(getContext(), -12));
    puckUp.setDuration(ANIMATE_DURATION_LONG_MILLIS);
    puckUp.setInterpolator(PathInterpolatorCompat.create(0, /* controlX1 */
    0, /* controlY1 */
    0, /* controlX2 */
    1));
    Animator puckDown = ObjectAnimator.ofFloat(contactPuckContainer, View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), -12), 0);
    puckDown.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    puckDown.setInterpolator(new FastOutSlowInInterpolator());
    Animator puckScaleUp = createUniformScaleAnimators(contactPuckBackground, 0.33f, /* beginScale */
    1.1f, /* endScale */
    ANIMATE_DURATION_NORMAL_MILLIS, PathInterpolatorCompat.create(0.4f, /* controlX1 */
    0, /* controlY1 */
    0, /* controlX2 */
    1));
    Animator puckScaleDown = createUniformScaleAnimators(contactPuckBackground, 1.1f, /* beginScale */
    1, /* endScale */
    ANIMATE_DURATION_NORMAL_MILLIS, new FastOutSlowInInterpolator());
    // Upward animation chain.
    lockEntryAnim.play(textUp).with(puckScaleUp).with(puckUp);
    // Downward animation chain.
    lockEntryAnim.play(textDown).with(puckDown).with(puckScaleDown).after(puckUp);
    lockEntryAnim.play(rejectTextShow).after(puckUp);
    // Add vibration animation.
    addVibrationAnimator(lockEntryAnim);
    lockEntryAnim.addListener(new AnimatorListenerAdapter() {

        public boolean canceled;

        @Override
        public void onAnimationCancel(Animator animation) {
            super.onAnimationCancel(animation);
            canceled = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (!canceled) {
                onEntryAnimationDone();
            }
        }
    });
    lockEntryAnim.start();
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 55 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project android_packages_apps_Dialer by LineageOS.

the class FlingUpDownMethod method createBreatheAnimation.

private Animator createBreatheAnimation() {
    AnimatorSet breatheAnimation = new AnimatorSet();
    float textOffset = DpUtil.dpToPx(getContext(), 42);
    Animator textUp = ObjectAnimator.ofFloat(swipeToAnswerText, View.TRANSLATION_Y, 0, /* begin pos */
    -textOffset);
    textUp.setInterpolator(new FastOutSlowInInterpolator());
    textUp.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    Animator textDown = ObjectAnimator.ofFloat(swipeToAnswerText, View.TRANSLATION_Y, -textOffset, 0);
    textDown.setInterpolator(new FastOutSlowInInterpolator());
    textDown.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    // "Swipe down to reject" text fade in
    Animator rejectTextShow = ObjectAnimator.ofFloat(swipeToRejectText, View.ALPHA, 1f);
    rejectTextShow.setInterpolator(new LinearOutSlowInInterpolator());
    rejectTextShow.setDuration(ANIMATE_DURATION_SHORT_MILLIS);
    rejectTextShow.setStartDelay(SWIPE_TO_DECLINE_FADE_IN_DELAY_MILLIS);
    // reject hint text translate in
    Animator rejectTextTranslate = ObjectAnimator.ofFloat(swipeToRejectText, View.TRANSLATION_Y, DpUtil.dpToPx(getContext(), HINT_REJECT_FADE_TRANSLATION_Y_DP), 0f);
    rejectTextTranslate.setInterpolator(new FastOutSlowInInterpolator());
    rejectTextTranslate.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    // reject hint text fade out
    Animator rejectTextHide = ObjectAnimator.ofFloat(swipeToRejectText, View.ALPHA, 0f);
    rejectTextHide.setInterpolator(new FastOutLinearInInterpolator());
    rejectTextHide.setDuration(ANIMATE_DURATION_SHORT_MILLIS);
    Interpolator curve = PathInterpolatorCompat.create(0.4f, /* controlX1 */
    0, /* controlY1 */
    0, /* controlX2 */
    1);
    float puckOffset = DpUtil.dpToPx(getContext(), 42);
    Animator puckUp = ObjectAnimator.ofFloat(contactPuckContainer, View.TRANSLATION_Y, -puckOffset);
    puckUp.setInterpolator(curve);
    puckUp.setDuration(ANIMATE_DURATION_LONG_MILLIS);
    final float scale = 1.0625f;
    Animator puckScaleUp = createUniformScaleAnimators(contactPuckBackground, 1, /* beginScale */
    scale, ANIMATE_DURATION_NORMAL_MILLIS, curve);
    Animator puckDown = ObjectAnimator.ofFloat(contactPuckContainer, View.TRANSLATION_Y, 0);
    puckDown.setInterpolator(new FastOutSlowInInterpolator());
    puckDown.setDuration(ANIMATE_DURATION_NORMAL_MILLIS);
    Animator puckScaleDown = createUniformScaleAnimators(contactPuckBackground, scale, 1, /* endScale */
    ANIMATE_DURATION_NORMAL_MILLIS, new FastOutSlowInInterpolator());
    // Bounce upward animation chain.
    breatheAnimation.play(textUp).with(rejectTextHide).with(puckUp).with(puckScaleUp).after(167);
    // Bounce downward animation chain.
    breatheAnimation.play(puckDown).with(textDown).with(puckScaleDown).with(rejectTextShow).with(rejectTextTranslate).after(puckUp);
    // Add vibration animation to the animator set.
    addVibrationAnimator(breatheAnimation);
    return breatheAnimation;
}
Also used : LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) AnimatorSet(android.animation.AnimatorSet) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) LinearOutSlowInInterpolator(android.support.v4.view.animation.LinearOutSlowInInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) Interpolator(android.view.animation.Interpolator) FastOutLinearInInterpolator(android.support.v4.view.animation.FastOutLinearInInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator)

Aggregations

FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)53 Animator (android.animation.Animator)20 ValueAnimator (android.animation.ValueAnimator)17 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)16 View (android.view.View)14 ObjectAnimator (android.animation.ObjectAnimator)11 AnimatorSet (android.animation.AnimatorSet)9 BindView (butterknife.BindView)8 RecyclerView (android.support.v7.widget.RecyclerView)5 TextView (android.widget.TextView)5 MaterialTapTargetPrompt (uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt)5 ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)4 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)4 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)3 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 TargetApi (android.annotation.TargetApi)2 Rect (android.graphics.Rect)2 Handler (android.os.Handler)2 FastOutLinearInInterpolator (android.support.v4.view.animation.FastOutLinearInInterpolator)2