List of usage examples for android.view.animation Animation setInterpolator
public void setInterpolator(Interpolator i)
From source file:Main.java
public static Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(DURATION);//from w w w.ja va 2 s . com inFromRight.setInterpolator(new AccelerateDecelerateInterpolator()); return inFromRight; }
From source file:Main.java
public static Animation inFromBottomAnimation() { Animation inFromBottom = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromBottom.setDuration(350);/* w ww . ja va2 s . co m*/ inFromBottom.setInterpolator(new AccelerateInterpolator()); return inFromBottom; }
From source file:Main.java
public static Animation inFromLeftAnimation() { Animation inFromLeft = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromLeft.setDuration(250);/*w w w .j a v a2s .c o m*/ inFromLeft.setInterpolator(new AccelerateInterpolator()); return inFromLeft; }
From source file:Main.java
public static Animation outToRightAnimation() { Animation outtoRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outtoRight.setDuration(250);//from www . j a v a2s.c o m outtoRight.setInterpolator(new AccelerateInterpolator()); return outtoRight; }
From source file:Main.java
public static Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(250);/*from w w w . java2 s . c om*/ inFromRight.setInterpolator(new AccelerateInterpolator()); return inFromRight; }
From source file:com.bluros.music.utils.FabAnimationUtils.java
public static void scaleIn(final View fab, long duration, final ScaleCallback callback) { fab.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(fab).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setDuration(duration) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).withLayer() .setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { if (callback != null) callback.onAnimationStart(); }//from www . j av a 2 s. com public void onAnimationCancel(View view) { } public void onAnimationEnd(View view) { view.setVisibility(View.VISIBLE); if (callback != null) callback.onAnimationEnd(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out); anim.setDuration(duration); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { if (callback != null) callback.onAnimationStart(); } public void onAnimationEnd(Animation animation) { fab.setVisibility(View.VISIBLE); if (callback != null) callback.onAnimationEnd(); } @Override public void onAnimationRepeat(Animation animation) { // } }); fab.startAnimation(anim); } }
From source file:com.capricorn.ArcMenu.java
private static Animation createQuickHintSwitchAnimation(final boolean expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setStartOffset(0);//from ww w. j ava 2 s. c o m animation.setDuration(10); animation.setInterpolator(new DecelerateInterpolator()); animation.setFillAfter(true); return animation; }
From source file:com.capricorn.ArcMenu.java
private static Animation createHintSwitchAnimation(final boolean expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setStartOffset(0);// w ww.j a v a2 s . c o m animation.setDuration(100); animation.setInterpolator(new DecelerateInterpolator()); animation.setFillAfter(true); return animation; }
From source file:Main.java
public static void collapse(final View v, final int initialHeight, final int targetHeight, int duration, Animation.AnimationListener listener) { final int diffHeight = initialHeight - targetHeight; Animation a = new Animation() { @Override// ww w . j a va 2 s . c o m protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = initialHeight - (int) (diffHeight * interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(duration); a.setInterpolator(new DecelerateInterpolator(2)); if (listener != null) { a.setAnimationListener(listener); } v.startAnimation(a); }
From source file:Main.java
public static void animateHeight(final View animated, final int from, final int to, final long duration, final Interpolator interpolator, final AnimationListener animationListener) { final Animation animation = new Animation() { @Override/*from w ww . j a v a 2s . co m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { final int newHeight = (int) (from + (to - from) * interpolatedTime); setHeight(animated, newHeight); } @Override public boolean willChangeBounds() { return true; } }; animation.setDuration(duration); animation.setInterpolator(interpolator); if (animationListener != null) { animation.setAnimationListener(animationListener); } animated.startAnimation(animation); }