Search in sources :

Example 21 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.

the class Slide method start.

@Override
public void start(@Nullable final IEndListener listener) {
    text.setAlpha(255);
    PropertyValuesHolder hHolder = null;
    PropertyValuesHolder vHolder = null;
    float fromX = 0;
    float toX = 0;
    float fromY = 0;
    float toY = 0;
    if ((side & Side.LEFT) == side) {
        if (toShow) {
            fromX = -text.getWidth();
        } else {
            toX = -text.getWidth();
        }
        hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
    } else if ((side & Side.RIGHT) == side) {
        if (toShow) {
            fromX = text.getWidth();
        } else {
            toX = text.getWidth();
        }
        hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
    }
    if ((side & Side.TOP) == side) {
        if (toShow) {
            fromY = -text.getHeight();
        } else {
            toY = -text.getHeight();
        }
        vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
    } else if ((side & Side.BOTTOM) == side) {
        if (toShow) {
            fromY = text.getHeight();
        } else {
            toY = text.getHeight();
        }
        vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
    }
    if (hHolder != null && vHolder != null) {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder, vHolder);
    } else if (hHolder != null) {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder);
    } else {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, vHolder);
    }
    animator.setInterpolator(new FastOutSlowInInterpolator());
    Utils.addEndListener(this, animator, new IEndListener() {

        @Override
        public void onAnimationEnd(ISurfaceAnimation animation) {
            text.removeEffect(Slide.this);
            if (!toShow)
                text.setAlpha(0);
            if (listener != null)
                listener.onAnimationEnd(Slide.this);
        }
    });
    animator.setDuration(duration);
    animator.addUpdateListener(this);
    animator.start();
}
Also used : ISurfaceAnimation(su.levenetc.android.textsurface.interfaces.ISurfaceAnimation) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) PropertyValuesHolder(android.animation.PropertyValuesHolder) IEndListener(su.levenetc.android.textsurface.interfaces.IEndListener)

Example 22 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project TextSurface by elevenetc.

the class TransSurface method start.

@Override
public void start(@Nullable final IEndListener listener) {
    float fromX = camera.getTransX();
    float fromY = camera.getTransY();
    float toX;
    float toY;
    if (textPivot == null) {
        toX = camera.getTransX() + dx;
        toY = camera.getTransY() + dy;
    } else {
        toX = textPivot.getPosition().getRelativeX(pivot, textPivot, true) * camera.getScale() * -1;
        toY = textPivot.getPosition().getRelativeY(pivot, textPivot, true) * camera.getScale() * -1;
    }
    debugTranslation(fromX, fromY, toX, toY);
    PropertyValuesHolder dxHolder = PropertyValuesHolder.ofFloat("transX", fromX, toX);
    PropertyValuesHolder dyHolder = PropertyValuesHolder.ofFloat("transY", fromY, toY);
    animator = ObjectAnimator.ofPropertyValuesHolder(camera, dxHolder, dyHolder);
    animator.setInterpolator(new FastOutSlowInInterpolator());
    Utils.addEndListener(this, animator, listener);
    animator.setDuration(duration);
    animator.addUpdateListener(this);
    animator.start();
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 23 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project ListenerMusicPlayer by hefuyicoder.

the class RotationFabBehavior method hide.

private void hide(final FloatingActionButton floatingActionButton) {
    AnimatorSet fabAnimation = (AnimatorSet) AnimatorInflater.loadAnimator(floatingActionButton.getContext(), R.animator.float_button_out);
    fabAnimation.setTarget(floatingActionButton);
    fabAnimation.setInterpolator(new FastOutSlowInInterpolator());
    fabAnimation.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            isAnimate = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            floatingActionButton.setVisibility(View.GONE);
            isAnimate = false;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            show(floatingActionButton);
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    fabAnimation.start();
}
Also used : Animator(android.animation.Animator) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 24 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project Transitions-Everywhere by andkulikov.

the class InterpolatorDurationStartDelaySample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_interpolator, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final View button = transitionsContainer.findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {

        boolean mToRightAnimation;

        @Override
        public void onClick(View v) {
            mToRightAnimation = !mToRightAnimation;
            Transition transition = new ChangeBounds();
            transition.setDuration(mToRightAnimation ? 700 : 300);
            transition.setInterpolator(mToRightAnimation ? new FastOutSlowInInterpolator() : new AccelerateInterpolator());
            transition.setStartDelay(mToRightAnimation ? 0 : 500);
            TransitionManager.beginDelayedTransition(transitionsContainer, transition);
            FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) button.getLayoutParams();
            params.gravity = mToRightAnimation ? (Gravity.RIGHT | Gravity.TOP) : (Gravity.LEFT | Gravity.TOP);
            button.setLayoutParams(params);
        }
    });
    return view;
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ViewGroup(android.view.ViewGroup) ChangeBounds(com.transitionseverywhere.ChangeBounds) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) FrameLayout(android.widget.FrameLayout) Transition(com.transitionseverywhere.Transition) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 25 with FastOutSlowInInterpolator

use of android.support.v4.view.animation.FastOutSlowInInterpolator in project native-navigation by airbnb.

the class AutoSharedElementCallback method getDefaultTransition.

@TargetApi(TARGET_API)
private Transition getDefaultTransition() {
    TransitionSet set = new TransitionSet();
    set.addTransition(new ChangeBounds());
    set.addTransition(new Fade());
    set.addTransition(new ChangeImageTransform());
    set.setInterpolator(new FastOutSlowInInterpolator());
    return set;
}
Also used : TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) Fade(android.transition.Fade) ChangeImageTransform(android.transition.ChangeImageTransform) TargetApi(android.annotation.TargetApi)

Aggregations

FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)35 View (android.view.View)11 Animator (android.animation.Animator)8 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)6 AnimatorSet (android.animation.AnimatorSet)6 ObjectAnimator (android.animation.ObjectAnimator)6 BindView (butterknife.BindView)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)4 ViewPropertyAnimatorListener (android.support.v4.view.ViewPropertyAnimatorListener)4 RecyclerView (android.support.v7.widget.RecyclerView)4 MotionEvent (android.view.MotionEvent)3 ViewGroup (android.view.ViewGroup)3 TextView (android.widget.TextView)3 ExitFragmentTransition (com.kogitune.activity_transition.fragment.ExitFragmentTransition)3 IEndListener (su.levenetc.android.textsurface.interfaces.IEndListener)3 ISurfaceAnimation (su.levenetc.android.textsurface.interfaces.ISurfaceAnimation)3 TargetApi (android.annotation.TargetApi)2 Rect (android.graphics.Rect)2 Nullable (android.support.annotation.Nullable)2 LinearOutSlowInInterpolator (android.support.v4.view.animation.LinearOutSlowInInterpolator)2