List of usage examples for android.view.animation Animation RELATIVE_TO_SELF
int RELATIVE_TO_SELF
To view the source code for android.view.animation Animation RELATIVE_TO_SELF.
Click Source Link
From source file:Main.java
private static TranslateAnimation getTranslateX100To0Animation(View view, long duration) { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0); animation.setDuration(duration);// w ww . j a v a 2 s . co m return animation; }
From source file:Main.java
private static TranslateAnimation getTranslateX0To100Animation(View view, long duration) { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0); animation.setDuration(duration);/*from ww w. j a v a2s . com*/ return animation; }
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 .ja va 2 s. c o 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 va 2 s .c o m rotate.setInterpolator(new LinearInterpolator()); rotate.setFillAfter(true); view.startAnimation(rotate); }
From source file:Main.java
public static TranslateAnimation getTranslateAnimationToSelf(float pivotFromX, float pivotToX, float pivotFromY, float pivotToY, int intDuration, boolean boolFillAfter) { TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, pivotFromX, Animation.RELATIVE_TO_SELF, pivotToX, Animation.RELATIVE_TO_SELF, pivotFromY, Animation.RELATIVE_TO_SELF, pivotToY); mAnmation.setDuration(intDuration);//from ww w .j a v a 2 s . com mAnmation.setFillAfter(boolFillAfter); // mAnmation.setRepeatMode(Animation.RESTART); // mAnmation.setRepeatCount(intRepeatCount); // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext, // com.webclient.R.anim.bounce_interpolator)); return mAnmation; }
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 ww . ja v a 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 void SlideInRight(View v, final Runnable onComplete) { v.clearAnimation();//from w w w . j av a 2 s . co m TranslateAnimation aout = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); aout.setDuration(300); v.startAnimation(aout); if (onComplete != null) aout.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationEnd(Animation arg0) { onComplete.run(); } }); }
From source file:Main.java
public static void SlideOutLeft(View v, final Runnable onComplete) { v.clearAnimation();/*from www . j a v a 2s.c o m*/ TranslateAnimation aout = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f); aout.setDuration(300); aout.setFillAfter(true); v.startAnimation(aout); if (onComplete != null) aout.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation arg0) { } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationEnd(Animation arg0) { onComplete.run(); } }); }
From source file:Main.java
public static void setTranslateAnimationToSelf(View view, float pivotFromX, float pivotToX, float pivotFromY, float pivotToY, int intDuration, boolean boolFillAfter) { TranslateAnimation mAnmation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, pivotFromX, Animation.RELATIVE_TO_SELF, pivotToX, Animation.RELATIVE_TO_SELF, pivotFromY, Animation.RELATIVE_TO_SELF, pivotToY); mAnmation.setDuration(intDuration);/* w w w. j ava2 s .c om*/ mAnmation.setFillAfter(boolFillAfter); // mAnmation.setRepeatMode(Animation.RESTART); // mAnmation.setRepeatCount(intRepeatCount); // mAnmation.setInterpolator(AnimationUtils.loadInterpolator(mContext, // com.webclient.R.anim.bounce_interpolator)); view.startAnimation(mAnmation); }
From source file:Main.java
public static Animation createScaleAnimation(float fromXScale, float toXScale, float fromYScale, float toYScale, long duration) { ScaleAnimation anim = new ScaleAnimation(fromXScale, toXScale, fromYScale, toYScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setFillAfter(true);/*from w w w . ja v a2 s . com*/ anim.setInterpolator(new AccelerateInterpolator()); anim.setDuration(duration); return anim; }