List of usage examples for android.view.animation Animation setInterpolator
public void setInterpolator(Interpolator i)
From source file:Main.java
public static Animation getFadeInAnimation(int duration) { Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); //add this fadeIn.setDuration(duration);/*w w w . java2 s .co m*/ return fadeIn; }
From source file:Main.java
public static Animation createAlpha(float fromAlpha, float toAlpha, long duration) { Animation animation = new AlphaAnimation(fromAlpha, toAlpha); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(duration);/*from ww w . jav a 2s . c om*/ return animation; }
From source file:Main.java
public static Animation shakeUpAndDownAnimation(int counts) { Animation translateAnimation = new TranslateAnimation(0, 0, 0, 10); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(500); return translateAnimation; }
From source file:Main.java
public static Animation shakeAnimation(int counts) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
From source file:Main.java
public static void shakeAnim(View view) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(4)); translateAnimation.setDuration(400); view.startAnimation(translateAnimation); }
From source file:Main.java
public static Animation getFadeOutAnimation(int durationInMilliseconds) { final Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setFillAfter(true);//from w ww .ja va2s . com fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setDuration(durationInMilliseconds); return fadeOut; }
From source file:Main.java
public static Animation fadeIn() { Animation fadein = new AlphaAnimation(0.0f, +1.0f); fadein.setDuration(DURATION);// w w w .j ava 2 s. c om fadein.setInterpolator(new DecelerateInterpolator()); // start quickly... return fadein; }
From source file:Main.java
public static Animation fadeOut() { Animation fadeout = new AlphaAnimation(+1.0f, 0.0f); fadeout.setDuration(DURATION);/*from w w w.j a v a2 s.c om*/ fadeout.setInterpolator(new AccelerateInterpolator()); return fadeout; }
From source file:Main.java
public static void startBlink(View view) { if (null == view) { return;//from w ww.j av a2 s. c om } Animation alphaAnimation = new AlphaAnimation(1, 0); alphaAnimation.setDuration(500); alphaAnimation.setInterpolator(new LinearInterpolator()); alphaAnimation.setRepeatCount(Animation.INFINITE); alphaAnimation.setRepeatMode(Animation.REVERSE); view.startAnimation(alphaAnimation); }
From source file:Main.java
public static void animateView(View view) { final Animation animation = new AlphaAnimation(1f, 0f); animation.setDuration(1000); // Animate for 1 seconds animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); view.startAnimation(animation);/*from www .j a v a 2s.c om*/ }