Search in sources :

Example 11 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class FlexibleSpaceLayout method animateHeaderViewScroll.

public void animateHeaderViewScroll(boolean toCollapsed) {
    ObjectAnimator animator = ObjectAnimator.ofInt(this, SCROLL, mScroll, toCollapsed ? mHeaderView.getScrollExtent() : 0);
    animator.setDuration(mMediumAnimationTime);
    animator.setInterpolator(new FastOutSlowInInterpolator());
    animator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator)

Example 12 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class AppBarWrapperLayout method show.

public void show() {
    if (mShowing) {
        return;
    }
    mShowing = true;
    cancelAnimator();
    mAnimator = new AnimatorSet().setDuration(mAnimationDuration);
    mAnimator.setInterpolator(new FastOutSlowInInterpolator());
    AnimatorSet.Builder builder = mAnimator.play(ObjectAnimator.ofFloat(this, TRANSLATION_Y, getTranslationY(), 0));
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        builder.with(ObjectAnimator.ofFloat(mShadowCompatView, ALPHA, mShadowCompatView.getAlpha(), 1));
    } else {
        builder.with(ObjectAnimator.ofFloat(mAppbarView, TRANSLATION_Z, mAppbarView.getTranslationZ(), 0));
    }
    startAnimator();
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 13 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Signal-Android by WhisperSystems.

the class HidingLinearLayout method animateWith.

private void animateWith(Animation animation) {
    animation.setDuration(150);
    animation.setInterpolator(new FastOutSlowInInterpolator());
    startAnimation(animation);
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator)

Example 14 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project react-native-navigation by wix.

the class InterpolationParser method parse.

public static TimeInterpolator parse(JSONObject json) {
    JSONObject interpolation = json.optJSONObject("interpolation");
    String type = interpolation == null ? "linear" : interpolation.optString("type", "linear");
    switch(type) {
        case "decelerate":
            {
                float factor = (float) interpolation.optDouble("factor", 1.0);
                return new DecelerateInterpolator(factor);
            }
        case "accelerateDecelerate":
            {
                return new AccelerateDecelerateInterpolator();
            }
        case "accelerate":
            {
                float factor = (float) interpolation.optDouble("factor", 1.0);
                return new AccelerateInterpolator(factor);
            }
        case "decelerateAccelerate":
            {
                return new DecelerateAccelerateInterpolator();
            }
        case "fastOutSlowIn":
            {
                return new FastOutSlowInInterpolator();
            }
        case "overshoot":
            {
                double tension = interpolation.optDouble("tension", 1.0);
                return new OvershootInterpolator((float) tension);
            }
        case "spring":
            {
                float mass = (float) interpolation.optDouble("mass", 3.0);
                float damping = (float) interpolation.optDouble("damping", 500.0);
                float stiffness = (float) interpolation.optDouble("stiffness", 200.0);
                boolean allowsOverdamping = interpolation.optBoolean("allowsOverdamping", false);
                float initialVelocity = (float) interpolation.optDouble("initialVelocity", 0);
                return new SpringInterpolator(mass, damping, stiffness, allowsOverdamping, initialVelocity);
            }
        case "linear":
        default:
            {
                return new LinearInterpolator();
            }
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) JSONObject(org.json.JSONObject) DecelerateAccelerateInterpolator(com.reactnativenavigation.options.interpolators.DecelerateAccelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) SpringInterpolator(com.reactnativenavigation.options.interpolators.SpringInterpolator) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) DecelerateAccelerateInterpolator(com.reactnativenavigation.options.interpolators.DecelerateAccelerateInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 15 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Signal-Android by WhisperSystems.

the class ViewUtil method getAlphaAnimation.

private static Animation getAlphaAnimation(float from, float to, int duration) {
    final Animation anim = new AlphaAnimation(from, to);
    anim.setInterpolator(new FastOutSlowInInterpolator());
    anim.setDuration(duration);
    return anim;
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AlphaAnimation(android.view.animation.AlphaAnimation)

Aggregations

FastOutSlowInInterpolator (androidx.interpolator.view.animation.FastOutSlowInInterpolator)34 ValueAnimator (android.animation.ValueAnimator)8 Animator (android.animation.Animator)6 Animation (android.view.animation.Animation)6 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)4 PropertyValuesHolder (android.animation.PropertyValuesHolder)4 View (android.view.View)4 ObjectAnimator (android.animation.ObjectAnimator)3 ViewGroup (android.view.ViewGroup)3 IEndListener (su.levenetc.android.textsurface.interfaces.IEndListener)3 ISurfaceAnimation (su.levenetc.android.textsurface.interfaces.ISurfaceAnimation)3 AnimatorSet (android.animation.AnimatorSet)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 AlphaAnimation (android.view.animation.AlphaAnimation)2 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)2 ScaleAnimation (android.view.animation.ScaleAnimation)2 Nullable (androidx.annotation.Nullable)2 Manifest (android.Manifest)1 TimeInterpolator (android.animation.TimeInterpolator)1