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
/** * Create a new rotating animation.//from w w w . j a va 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 GridLayoutAnimationController getLayoutAnimation() { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(40);/*from ww w. ja v a 2 s.c om*/ set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(75); set.addAnimation(animation); GridLayoutAnimationController controller = new GridLayoutAnimationController(set); return controller; }
From source file:Main.java
public static AnimationSet RotateAndFadeInAnimation() { AlphaAnimation fade_in = new AlphaAnimation(0.2f, 1f); fade_in.setDuration(400);/* w ww.ja va 2s.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 void makeViewGroupAnimation(ViewGroup viewGroup) { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(50);/*from ww w.j av a2 s . c o m*/ set.addAnimation(animation); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(150); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); viewGroup.setLayoutAnimation(controller); }
From source file:Main.java
public static AnimationSet RotateAndFadeOutAnimation() { AlphaAnimation fade_out = new AlphaAnimation(1f, 0.2f); fade_out.setDuration(500);//from w w w .ja 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
private static void scaleDownAni(View v) { /*if(scaleDownAni == null){ scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleDownAni.setDuration(SCALE_ANI_DURATION); scaleDownAni.setFillAfter(true);// www. j a v a 2 s . c o m }*/ ScaleAnimation scaleDownAni = new ScaleAnimation(1.0f, SCALE_DOWN_VALUE, 1.0f, SCALE_DOWN_VALUE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleDownAni.setDuration(SCALE_ANI_DURATION); scaleDownAni.setFillAfter(true); //v.startAnimation(scaleDownAni); //v.setAnimation(scaleDownAni); //scaleDownAni.startNow(); v.startAnimation(scaleDownAni); /*v.animate().scaleX(SCALE_DOWN_VALUE); v.animate().scaleY(SCALE_DOWN_VALUE); v.animate().setDuration(SCALE_ANI_DURATION); v.animate().start();*/ //v.setScaleX(SCALE_DOWN_VALUE); //v.setScaleY(SCALE_DOWN_VALUE); }
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 om*/ 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 Animation createShowTranslateAnimation() { final Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f);/*from w w w.jav a 2 s. c o m*/ return animation; }
From source file:Main.java
public static Animation createHiddenTranslateAnimation() { final Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f);/*from w w w . j ava2s.co m*/ return animation; }
From source file:Main.java
public static Animation createShowTranslateAnimationOnX() { final Animation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);//ww w . jav a 2 s .co m animation.setDuration(1500); return animation; }