List of usage examples for android.animation Animator setInterpolator
public abstract void setInterpolator(TimeInterpolator value);
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void show() { Animator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start();/* w w w. j a va2 s. c o m*/ }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void hide() { Animator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start();// w w w. ja va 2 s . c o m }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void rotate() { Animator animator = ObjectAnimator.ofFloat(view, View.ROTATION, view.getRotation(), view.getRotation() + 180);/*from w ww . j ava 2 s.co m*/ animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start(); }
From source file:com.ruesga.rview.fragments.RevealDialogFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void performEnterRevealTransition() { if (!mDoReveal || getDialog() == null || getDialog().getWindow() == null) { mDoReveal = false;/*w w w . ja v a 2s. c om*/ return; } final View v = getDialog().getWindow().getDecorView(); if (!v.isAttachedToWindow()) { mDoReveal = false; return; } v.setVisibility(View.VISIBLE); Rect dialogRect = computeViewOnScreen(v); int cx = v.getMeasuredWidth() / 2; int cy = v.getMeasuredHeight() / 2; if (mAnchorRect != null) { cx = Math.min(Math.max(mAnchorRect.centerX(), dialogRect.left), dialogRect.right) - dialogRect.left; cy = Math.min(Math.max(mAnchorRect.centerY(), dialogRect.top), dialogRect.bottom) - dialogRect.top; } int finalRadius = Math.max(v.getWidth(), v.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius); anim.setDuration(350); anim.setInterpolator(new AccelerateInterpolator()); anim.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { onDialogReveled(); mDoReveal = false; } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); anim.start(); }
From source file:ooo.oxo.apps.materialize.SearchPanelController.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private Animator makeSearchPanelAnimator(boolean reverse) { int width = container.getWidth(); int centerX = container.getRight() + container.getPaddingRight() - resources.getDimensionPixelOffset(R.dimen.reveal_right) / 4 * 3; int centerY = container.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(container, centerX, centerY, reverse ? width : 0, reverse ? 0 : width); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(resources.getInteger(android.R.integer.config_mediumAnimTime)); return animator; }
From source file:com.sysdata.widget.accordion.CollapsedViewHolder.java
private Animator createExpandingAnimator(ArrowItemViewHolder newHolder, long duration) { if (arrow != null) { arrow.setVisibility(View.INVISIBLE); }/*from w ww . ja v a2 s .c om*/ final View oldView = itemView; final View newView = newHolder.itemView; final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView) .setDuration(duration); boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(boundsAnimator); return animatorSet; }
From source file:com.example.toolbardemo.Fragment.CircularRevealFragment.java
/** * {@inheritDoc}/*from ww w . j a v a 2 s. co m*/ * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle) */ @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); tv1 = (TextView) getActivity().findViewById(R.id.textView1); tv2 = (TextView) getActivity().findViewById(R.id.textView2); tv3 = (TextView) getActivity().findViewById(R.id.textView3); tv4 = (TextView) getActivity().findViewById(R.id.textView4); tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv1, tv1.getWidth() / 2, tv1.getHeight() / 2, tv1.getWidth(), 0); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv2, 0, 0, 0, (float) Math.hypot(tv2.getWidth(), tv2.getHeight())); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv3, tv3.getWidth() / 2, tv3.getHeight() / 2, 0, tv3.getWidth()); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); tv4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Animator animator = ViewAnimationUtils.createCircularReveal(tv4, 0, 0, (float) Math.hypot(tv4.getWidth(), tv4.getHeight()), 0); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(1000); animator.start(); } }); }
From source file:com.sysdata.widget.accordion.CollapsedViewHolder.java
private Animator createCollapsingAnimator(ArrowItemViewHolder oldHolder, long duration) { final View oldView = oldHolder.itemView; final View newView = itemView; final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(newView, oldView, newView) .setDuration(duration);//w w w. ja v a2 s .c o m boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); final AnimatorSet animatorSet; if (arrow != null) { final View oldArrow = oldHolder.arrow; final Rect oldArrowRect = new Rect(0, 0, oldArrow.getWidth(), oldArrow.getHeight()); final Rect newArrowRect = new Rect(0, 0, arrow.getWidth(), arrow.getHeight()); ((ViewGroup) newView).offsetDescendantRectToMyCoords(arrow, newArrowRect); ((ViewGroup) oldView).offsetDescendantRectToMyCoords(oldArrow, oldArrowRect); final float arrowTranslationY = oldArrowRect.bottom - newArrowRect.bottom; arrow.setTranslationY(arrowTranslationY); arrow.setVisibility(View.VISIBLE); final Animator arrowAnimation = ObjectAnimator.ofFloat(arrow, View.TRANSLATION_Y, 0f) .setDuration(duration); arrowAnimation.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN); animatorSet = new AnimatorSet(); animatorSet.playTogether(boundsAnimator, arrowAnimation); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { AnimatorUtils.startDrawableAnimation(arrow); } }); } else { animatorSet = new AnimatorSet(); animatorSet.playTogether(boundsAnimator); } return animatorSet; }
From source file:com.example.android.revealeffectbasic.RevealEffectBasicFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.reveal_effect_basic, container, false); View button = rootView.findViewById(R.id.button); // Set a listener to reveal the view when clicked. button.setOnClickListener(new View.OnClickListener() { @Override/* w w w. j a v a 2s. com*/ public void onClick(View view) { View shape = rootView.findViewById(R.id.circle); // Create a reveal {@link Animator} that starts clipping the view from // the top left corner until the whole view is covered. Animator animator = ViewAnimationUtils.createCircularReveal(shape, 0, 0, 0, (float) Math.hypot(shape.getWidth(), shape.getHeight())); // Set a natural ease-in/ease-out interpolator. animator.setInterpolator(new AccelerateDecelerateInterpolator()); // Finally start the animation animator.start(); Log.d(TAG, "Starting Reveal animation"); } }); return rootView; }
From source file:com.chrynan.guitartuner.PitchFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public Animator unreveal(final float x, final float y) { Animator anim = ViewAnimationUtils.createCircularReveal(getView(), (int) x, (int) y, (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()), 0); anim.setInterpolator(new AccelerateInterpolator(0.5f)); anim.setDuration(500);//from w w w . ja va 2 s. c o m return anim; }