List of usage examples for android.view.animation RotateAnimation setFillAfter
public void setFillAfter(boolean fillAfter)
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 .j ava2 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
public static void rotate0to180(View view) { RotateAnimation rotate = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(ANIM);/*from w ww . j a va 2 s .co m*/ rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); view.startAnimation(rotate); }
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);//from w w w . j a v a2s . c o m 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);//from w w w .ja 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 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);//from w w w . ja v a 2 s. co m 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); 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 AnimationSet RotateAndFadeInAnimation() { AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f); fade_in.setDuration(400);//from w w w.j ava 2 s . c om 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 AnimationSet RotateAndFadeOutAnimation() { AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f); fade_out.setDuration(500);/*w w w. j a v a 2s. c o m*/ fade_out.setStartOffset(0); fade_out.setFillAfter(true); ScaleAnimation shrink = new ScaleAnimation(1f, 0.2f, 1f, 0.2f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f); shrink.setDuration(400); shrink.setStartOffset(0); shrink.setFillAfter(true); RotateAnimation rotate = new RotateAnimation(0.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_out); Reload.addAnimation(shrink); Reload.addAnimation(rotate); Reload.setInterpolator(new AccelerateInterpolator(1.1f)); return Reload; }
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 ww w .j a v a 2 s .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:MainActivity.java
private void calculateCompassDirection(SensorEvent event) { switch (event.sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: mAccelerationValues = event.values.clone(); break;//from w w w .java 2 s . com case Sensor.TYPE_MAGNETIC_FIELD: mGravityValues = event.values.clone(); break; } boolean success = SensorManager.getRotationMatrix(mRotationMatrix, null, mAccelerationValues, mGravityValues); if (success) { float[] orientationValues = new float[3]; SensorManager.getOrientation(mRotationMatrix, orientationValues); float azimuth = (float) Math.toDegrees(-orientationValues[0]); RotateAnimation rotateAnimation = new RotateAnimation(mLastDirectionInDegrees, azimuth, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setDuration(50); rotateAnimation.setFillAfter(true); mImageViewCompass.startAnimation(rotateAnimation); mLastDirectionInDegrees = azimuth; } }
From source file:org.onebusaway.android.ui.ArrivalsListHeader.java
/** * Creates and returns a new rotation animation for the expand/collapse image based on the * provided startState and endState.//from w w w . j a v a 2s . c o m * * @param startState beginning state of the image, either ANIM_STATE_NORMAL or * ANIM_STATE_INVERTED * @param endState end state of the image, either ANIM_STATE_NORMAL or ANIM_STATE_INVERTED * @return a new rotation animation for the expand/collapse image */ private static RotateAnimation getRotation(float startState, float endState) { RotateAnimation r = new RotateAnimation(startState, endState, Animation.RELATIVE_TO_SELF, ANIM_PIVOT_VALUE, Animation.RELATIVE_TO_SELF, ANIM_PIVOT_VALUE); r.setDuration(ANIM_DURATION); r.setFillAfter(true); return r; }