List of usage examples for android.view.animation AlphaAnimation setDuration
public void setDuration(long durationMillis)
From source file:Main.java
public static List<Animation> initAnimation(int AnimationType, float fromAlpha, float toAlpha, float fromDegress, float toDegress, float pinX, float pinY) { List<Animation> animations = new ArrayList<>(); AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha); alphaAnimation.setDuration(300); AlphaAnimation exit_alphaAnimation = new AlphaAnimation(toAlpha, fromAlpha); exit_alphaAnimation.setDuration(300); OvershootInterpolator overshootInterpolator = new OvershootInterpolator(3.5f); RotateAnimation rotateAnimation = new RotateAnimation(fromDegress, toDegress, AnimationType, pinX, AnimationType, pinY);/*from w ww . j a va2 s. c o m*/ rotateAnimation.setDuration(300); rotateAnimation.setInterpolator(overshootInterpolator); rotateAnimation.setFillAfter(true); RotateAnimation exit_rotateAnimation = new RotateAnimation(toDegress, fromAlpha, AnimationType, pinX, AnimationType, pinY); exit_rotateAnimation.setDuration(300); exit_rotateAnimation.setInterpolator(overshootInterpolator); exit_rotateAnimation.setFillAfter(true); animations.add(alphaAnimation); animations.add(exit_alphaAnimation); animations.add(rotateAnimation); animations.add(exit_rotateAnimation); return animations; }
From source file:Main.java
public static void SetMenuAnimation(final ImageView v, final int bg1, final int bg2) { v.setImageResource(bg1);//from w w w . j ava 2 s . com AlphaAnimation anim = new AlphaAnimation(0.8f, 1); anim.setDuration(1000); anim.setRepeatCount(Animation.INFINITE); // anim1.setRepeatMode(Animation.REVERSE); anim.setInterpolator(new AccelerateInterpolator()); anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub num++; if (num == 10) { num = 0; } if (num % 2 == 0) { v.setImageResource(bg1); } else { v.setImageResource(bg2); } } @Override public void onAnimationEnd(Animation arg0) { // TODO Auto-generated method stub } }); v.startAnimation(anim); }
From source file:Main.java
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) { AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha); alphaAnimation.setDuration(durationMillis); if (animationListener != null) { alphaAnimation.setAnimationListener(animationListener); }/*from w w w . j a v a 2 s . com*/ return alphaAnimation; }
From source file:Main.java
public static AnimationSet flash(final android.view.animation.Animation.AnimationListener animationlistener) { final AnimationSet animationset = new AnimationSet(true); final AlphaAnimation alphaanimation = new AlphaAnimation(0F, 1F); alphaanimation.setStartOffset(500L); alphaanimation.setDuration(100L); animationset.addAnimation(alphaanimation); final AlphaAnimation alphaanimation1 = new AlphaAnimation(1F, 0F); alphaanimation1.setDuration(100L);/*from ww w . j a v a2 s. c o m*/ alphaanimation1.setStartOffset(1200L); animationset.addAnimation(alphaanimation1); animationset.setAnimationListener(animationlistener); return animationset; }
From source file:Main.java
public static AlphaAnimation fadeBackgroundAnimation() { AlphaAnimation alpha = new AlphaAnimation(0.5f, 0.2f); alpha.setRepeatCount(Animation.INFINITE); alpha.setRepeatMode(Animation.REVERSE); alpha.setDuration(1200); alpha.setFillAfter(true);//from w ww. j av a 2 s . c om return alpha; }
From source file:org.wheelmap.android.utils.ViewTool.java
public static void setAlphaForView(View alphaView, float alpha) { AlphaAnimation animation = new AlphaAnimation(alpha, alpha); animation.setDuration(0); animation.setFillAfter(true);/*from w w w. ja va 2 s . co m*/ alphaView.startAnimation(animation); }
From source file:com.dm.material.dashboard.candybar.utils.Animator.java
public static void startAlphaAnimation(@Nullable View view, long duration, int visibility) { if (view == null) return;/*from w w w. j a v a 2 s.c o m*/ AlphaAnimation alphaAnimation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f) : new AlphaAnimation(1f, 0f); alphaAnimation.setDuration(duration); alphaAnimation.setFillAfter(true); view.startAnimation(alphaAnimation); }
From source file:com.findme.views.ExpandableTextView.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void applyAlphaAnimation(View view, float alpha) { if (isPostHoneycomb()) { view.setAlpha(alpha);// w w w . j a va 2s .c om } else { AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha); // make it instant alphaAnimation.setDuration(0); alphaAnimation.setFillAfter(true); view.startAnimation(alphaAnimation); } }
From source file:me.tylerbwong.pokebase.gui.activities.PokemonProfileActivity.java
public static void startAlphaAnimation(View view, long duration, int visibility) { AlphaAnimation alphaAnimation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f) : new AlphaAnimation(1f, 0f); alphaAnimation.setDuration(duration); alphaAnimation.setFillAfter(true);/*from w ww . j ava 2s . c o m*/ view.startAnimation(alphaAnimation); }
From source file:com.pdftron.pdf.utils.ViewerUtils.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void animateView(final View view, final PDFViewCtrl pdfViewCtrl) { // Example of another animation that could be applied to the view. //ValueAnimator colorAnim = ObjectAnimator.ofInt(view, "backgroundColor", /*Red*/0xFFFF8080, /*Blue*/0xFF8080FF); //colorAnim.setDuration(1500); //colorAnim.setEvaluator(new ArgbEvaluator()); //colorAnim.setRepeatCount(2); //colorAnim.setRepeatMode(ValueAnimator.REVERSE); // Honeycomb introduced new Animation classes that are easier to use // and provide more options. Let's do a runtime check here and use // older classes for pre-Honeycomb devices. if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { AlphaAnimation anim1 = new AlphaAnimation(0.0f, 1.0f); final AlphaAnimation anim2 = new AlphaAnimation(1.0f, 0.0f); anim1.setDuration(500); anim2.setDuration(500);//w ww. j av a 2 s. com anim1.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.startAnimation(anim2); } }); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (pdfViewCtrl != null) { pdfViewCtrl.removeView(view); } } }); view.startAnimation(anim1); } else { // Since we want the flashing view to be removed once the animation // is finished, we use this listener to remove the view from // PDFViewCtrl when the event is triggered. Animator.AnimatorListener animListener = new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { pdfViewCtrl.removeView(view); } @Override public void onAnimationCancel(Animator animation) { } }; // Get animator for the flashing view. Animator fader = createAlphaAnimator(view, animListener); // If using more than one animator, you can create a set and // play them together, or in some other order... AnimatorSet animation = new AnimatorSet(); animation.playTogether(/*colorAnim, */fader); animation.start(); } }