List of usage examples for android.view.animation TranslateAnimation TranslateAnimation
public TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
From source file:Main.java
public static void startTranslationAnimation(View view) { TranslateAnimation translateAnimation = new TranslateAnimation(-50f, 50f, 0, 0); translateAnimation.setDuration(1000); translateAnimation.setRepeatCount(Animation.INFINITE); translateAnimation.setRepeatMode(Animation.REVERSE); view.setAnimation(translateAnimation); translateAnimation.start();//from w w w . ja va2 s .c om }
From source file:Main.java
public static Animation shakeAnimation(int counts) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
From source file:Main.java
public static void againStartMyAnimation(long fromx, long tox, long fromy, long toy, View t, boolean f) { if (f) {// ww w. ja v a 2 s. co m Animation animation = new TranslateAnimation(fromx, tox, fromy, toy); animation.setDuration(1000); animation.setFillAfter(true); t.startAnimation(animation); } }
From source file:Main.java
public static AnimationSet ShuffleAnimation(int deltaX, int deltaY) { TranslateAnimation shake_1 = new TranslateAnimation(0, deltaX, 0, deltaY); shake_1.setDuration(400);//from w w w . java 2s . c o m shake_1.setStartOffset(0); shake_1.setFillAfter(true); TranslateAnimation shake_2 = new TranslateAnimation(0, -deltaX, 0, -deltaY); shake_2.setDuration(400); shake_2.setStartOffset(400); shake_2.setFillAfter(true); AnimationSet ShakeIt = new AnimationSet(true); ShakeIt.addAnimation(shake_1); ShakeIt.addAnimation(shake_2); ShakeIt.setInterpolator(new OvershootInterpolator()); return ShakeIt; }
From source file:Main.java
public static TranslateAnimation getTranslation(int fromX, int toX, int fromY, int toY, int duration, Animation.AnimationListener listener) { TranslateAnimation anim = new TranslateAnimation(fromX, toX, fromY, toY); anim.setDuration(duration);//from w w w. j a v a 2 s.c om anim.setFillAfter(true); anim.setAnimationListener(listener); return anim; }
From source file:Main.java
public static void hideRadioSlowy(View view, long mi) { Animation animation = new TranslateAnimation(0, 0, 0, 100); animation.setDuration(mi);/*from ww w.j av a 2s. co m*/ animation.setFillAfter(true); view.startAnimation(animation); }
From source file:Main.java
public static AnimationSet translate(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, int duration) { Animation animation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta); animation.setDuration(duration);//from ww w .j av a2s . c om AnimationSet animationSet = new AnimationSet(true); // animationSet.setInterpolator(new AccelerateInterpolator()); animationSet.addAnimation(animation); return animationSet; }
From source file:Main.java
public static Animation getTranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long durationMillis) { TranslateAnimation translate = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta); translate.setDuration(durationMillis); translate.setFillAfter(true);/*from w w w . j a v a 2 s. c om*/ return translate; }
From source file:Main.java
/** * Animates a view sliding in from the left * @param view/*from ww w. jav a 2 s. co m*/ */ public static void slideInLeft(final View view, int duration) { final Animation inLeft = new TranslateAnimation(view.getX() - view.getWidth(), 0, 0, view.getX()); inLeft.setDuration(duration); view.startAnimation(inLeft); }
From source file:Main.java
/** * move the background view(translate animation). * /*ww w . ja v a 2s. c o m*/ * @param view * the view will be moved * @param durationMillis * translate animation duration * @param fromX * from X coordinate * @param toX * to X coordinate * @param fromY * from Y coordinate * @param toY * to Y coordinate */ public static void translate(View view, long durationMillis, boolean fillAfter, float fromX, float toX, float fromY, float toY) { TranslateAnimation ta = new TranslateAnimation(fromX, toX, fromY, toY); ta.setDuration(durationMillis); ta.setFillAfter(fillAfter);//this animation performed will persist when it is finished view.startAnimation(ta); }