List of usage examples for android.view.animation RotateAnimation RotateAnimation
public RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
From source file:Main.java
public static void rotate180to360(View view) { RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(ANIM);/* w w w. j av a 2 s . com*/ rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); view.startAnimation(rotate); }
From source file:Main.java
public static void startRepeatSelfRotateAnimation(View v, long duration, Animation.AnimationListener listener) { RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(duration);//w ww . j a va 2 s . c o m animation.setRepeatCount(-1); // Repeat animation animation.setFillAfter(true); animation.setRepeatMode(Animation.INFINITE); // LinearInterpolator lir = new LinearInterpolator(); animation.setInterpolator(lir); if (listener != null) { animation.setAnimationListener(listener); } v.startAnimation(animation); }
From source file:Main.java
public static RotateAnimation getRotateAnimation(float fromAngle, float toAngle, float pivotX, float pivotY, int intDuration, int intRepeatCount, boolean boolFillAfter) { RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY); mAnmation.setDuration(intDuration);/*from w w w . j a va2 s . co m*/ mAnmation.setFillAfter(boolFillAfter); if (intRepeatCount != 1) { mAnmation.setRepeatMode(Animation.RESTART); mAnmation.setRepeatCount(intRepeatCount); } // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext, // com.webclient.R.anim.bounce_interpolator)); mAnmation.setInterpolator(new LinearInterpolator()); return mAnmation; }
From source file:Main.java
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) { RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);//from w w w .j a va 2 s.c om rotateAnimation.setDuration(durationMillis); if (animationListener != null) { rotateAnimation.setAnimationListener(animationListener); } return rotateAnimation; }
From source file:Main.java
public static void setRotateAnimation(View view, float fromAngle, float toAngle, float pivotX, float pivotY, int intDuration, int intRepeatCount, boolean boolFillAfter) { RotateAnimation mAnmation = new RotateAnimation(fromAngle, toAngle, Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY); mAnmation.setDuration(intDuration);//from w w w . ja va 2 s. c om mAnmation.setFillAfter(boolFillAfter); if (intRepeatCount != 1) { mAnmation.setRepeatMode(Animation.RESTART); mAnmation.setRepeatCount(intRepeatCount); } // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext, // com.webclient.R.anim.bounce_interpolator)); mAnmation.setInterpolator(new LinearInterpolator()); view.startAnimation(mAnmation); }
From source file:Main.java
/** * Returns rotate animation that is set to refresh button to rotate refresh button. * /*from w ww . j a va 2 s . c o m*/ * @return RotateAnimation */ public static RotateAnimation getRefreshButtonAnimation() { rotateAnim = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnim.setDuration(800); rotateAnim.setInterpolator(new LinearInterpolator()); rotateAnim.setInterpolator(new LinearInterpolator()); rotateAnim.setRepeatCount(RotateAnimation.INFINITE); return rotateAnim; }
From source file:Main.java
/** * Create a new rotating animation.//from w ww.j a v a 2 s .c o m * @return a rotation animation */ public static RotateAnimation rotateAnimation() { RotateAnimation rotate = new RotateAnimation(0f, ROTATION, Animation.RELATIVE_TO_SELF, PIVOT, Animation.RELATIVE_TO_SELF, PIVOT); rotate.setDuration(ANIMATION_DURATION); rotate.setRepeatMode(Animation.RESTART); rotate.setRepeatCount(Animation.INFINITE); return rotate; }
From source file:Main.java
public static void rotate(final View view, float fromDegrees, float toDegrees, long duration) { if (Build.VERSION.SDK_INT >= 12) { if (duration == 0) view.setRotation(toDegrees); else/*from w w w .j ava2s .c o m*/ view.animate().rotation(toDegrees).setDuration(duration).start(); } else { RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(duration); rotate.setFillEnabled(true); rotate.setFillBefore(true); rotate.setFillAfter(true); addAnimation(view, rotate); } }
From source file:Main.java
public static AnimationSet RotateAndFadeInAnimation() { AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f); fade_in.setDuration(400);//w w w . j a v a2 s . c o m fade_in.setStartOffset(0); fade_in.setFillAfter(true); ScaleAnimation expand = new ScaleAnimation(0.2f, 1, 0.2f, 1, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); expand.setDuration(500); expand.setStartOffset(0); expand.setFillAfter(true); RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); rotate.setDuration(500); rotate.setStartOffset(0); // rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); AnimationSet Reload = new AnimationSet(true); Reload.addAnimation(fade_in); Reload.addAnimation(expand); Reload.addAnimation(rotate); Reload.setInterpolator(new DecelerateInterpolator(1.3f)); return Reload; }
From source file:Main.java
public static Animation createForeverRotationAnimation() { Animation mRotateAnimation = new RotateAnimation(0, 1080, Animation.RESTART, 0.5f, Animation.RESTART, 0.5f); mRotateAnimation.setInterpolator(new LinearInterpolator()); mRotateAnimation.setRepeatCount(Animation.INFINITE); mRotateAnimation.setRepeatMode(Animation.RESTART); mRotateAnimation.setStartTime(Animation.START_ON_FIRST_FRAME); return mRotateAnimation; }