List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:Main.java
/** * translation y/*from w ww.j av a2 s. c om*/ * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void translationY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * translation x/*from w ww . j a v a 2s .c om*/ * * @param v * @param fromX * @param toX * @param duration * @param animatorListener */ public static void translationX(View v, float fromX, float toX, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_X, fromX, toX); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
public static Animator moveScrollViewToX(View view, int toX, int time, int delayTime, boolean isStart) { ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "scrollX", new int[] { toX }); objectAnimator.setDuration(time);//from ww w . j a v a 2 s . co m objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.setStartDelay(delayTime); if (isStart) objectAnimator.start(); return objectAnimator; }
From source file:Main.java
public static void shake(View v) { final float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4.0f, v.getResources().getDisplayMetrics()); final ObjectAnimator animator = ObjectAnimator.ofFloat(v, "translationX", 0, distance, 0, -distance, 0); animator.setRepeatMode(ObjectAnimator.RESTART); animator.setInterpolator(new LinearInterpolator()); animator.setRepeatCount(4);//from ww w . j a va2 s . c o m animator.setDuration(150); animator.start(); }
From source file:Main.java
/** * Create fade in animation for appearing effect * * @param target target view for animating * @param durationInMilis animation duration * @param delayInMilis start animation in delay * @param listener listener of animation behaviour *///from w w w . j a v a 2s . c o m public static void setFadeAppearEffect(View target, int durationInMilis, int delayInMilis, Animator.AnimatorListener listener) { ObjectAnimator alphaAnimation6 = ObjectAnimator.ofFloat(target, "alpha", 0.0F, 1.0F); alphaAnimation6.setStartDelay(delayInMilis); alphaAnimation6.setDuration(durationInMilis); if (listener != null) { alphaAnimation6.addListener(listener); } alphaAnimation6.start(); }
From source file:Main.java
/** * Create fade out animation for disappearing effect * * @param target target view for animating * @param durationInMilis animation duration * @param delayInMilis start animation in delay * @param listener listener of animation behaviour */// w ww . j a va 2 s. c o m public static void setFadeDisappearEffect(View target, int durationInMilis, int delayInMilis, Animator.AnimatorListener listener) { ObjectAnimator alphaAnimation6 = ObjectAnimator.ofFloat(target, "alpha", 1.0F, 0.0F); alphaAnimation6.setStartDelay(delayInMilis); alphaAnimation6.setDuration(durationInMilis); if (listener != null) { alphaAnimation6.addListener(listener); } alphaAnimation6.start(); }
From source file:Main.java
public static void breath(View v, float fromRange, float toRange, long duration) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, fromRange, toRange); animator.setDuration(duration);/*from www. j a v a2 s. co m*/ animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.start(); }
From source file:Main.java
public static ObjectAnimator to_alpha(View target) { ObjectAnimator objectAnimator = null; if (null != target && target.getVisibility() != View.VISIBLE) { target.setVisibility(View.VISIBLE); objectAnimator = ObjectAnimator.ofFloat(target, View.ALPHA, 0f, 1f) .setDuration(BUBBLE_ANIMATION_DURATION); objectAnimator.start(); }// ww w . ja v a 2 s . com return objectAnimator; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void fadeOutHoneyComb(final View view) { view.setAlpha(1.0F);/*from w ww .j a v a 2 s .co m*/ ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 1.0F, 0.0F).setDuration(ANIMATION_DURATION); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(android.animation.Animator animation) { view.setVisibility(View.GONE); view.setAlpha(1.0F); } }); animator.start(); }
From source file:Main.java
public static void animHide(final View v, int duration, float from, float to, final boolean gone) { v.clearAnimation();//from w ww .j a v a 2 s . co m ObjectAnimator anim = ObjectAnimator.ofFloat(v, "alpha", from, to).setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (gone) { v.setVisibility(View.GONE); } } }); anim.start(); }