List of usage examples for android.animation ObjectAnimator setDuration
@Override @NonNull public ObjectAnimator setDuration(long duration)
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); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.setStartDelay(delayTime); if (isStart)// w ww. jav a 2s . c o m objectAnimator.start(); return objectAnimator; }
From source file:Main.java
public static ObjectAnimator animateTranslateX(final View view, float initialX, float finalX, int duration, int delay) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "TranslationX", initialX, finalX); animator.setDuration(duration); if (delay > 0) animator.setStartDelay(delay);/*ww w. j a v a 2 s . c o m*/ // go for it animator.start(); return animator; }
From source file:Main.java
public static ObjectAnimator inflate(final View v) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(v, scaleX, scaleY); animator.setDuration(ANIM_DURATION_INFLATE); animator.addListener(new AnimatorListenerAdapter() { @Override//from w w w . j a va 2 s. co m public void onAnimationStart(Animator animation) { v.setVisibility(View.VISIBLE); } }); return animator; }
From source file:Main.java
public static void showBackgroundColorAnimation(View view, int preColor, int currColor, int duration) { ObjectAnimator animator = ObjectAnimator.ofInt(view, "backgroundColor", new int[] { preColor, currColor }); animator.setDuration(duration); animator.setEvaluator(new ArgbEvaluator()); animator.start();//w w w . java2 s .c om }
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); animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.start();/*from ww w . j a v a 2s .c o m*/ }
From source file:Main.java
public static ObjectAnimator inflateFadeIn(final View v) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(v, scaleX, scaleY, alpha); animator.setDuration(ANIM_DURATION_INFLATE); animator.addListener(new AnimatorListenerAdapter() { @Override//w w w . j a v a2s . c o m public void onAnimationStart(Animator animation) { v.setVisibility(View.VISIBLE); } }); return animator; }
From source file:Main.java
/** * shake x// w ww .j a v a 2 s. c o m * * @param v * @param offset * @param duration * @param times */ public static void shakeX(View v, float offset, long duration, float times) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_X, 0, offset); animator.setDuration(duration); animator.setInterpolator(new CycleInterpolator(times)); animator.start(); }
From source file:Main.java
/** * shake y//from w ww .j a v a2s .co m * * @param v * @param offset * @param duration * @param times */ public static void shakeY(View v, float offset, long duration, float times) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_Y, 0, offset); animator.setDuration(duration); animator.setInterpolator(new CycleInterpolator(times)); animator.start(); }
From source file:Main.java
/** * scale y/*from w ww . j a va 2s . c om*/ * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void scaleY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * scale x// w ww. ja v a2s .co m * * @param v * @param fromX * @param toX * @param duration * @param animatorListener */ public static void scaleX(View v, float fromX, float toX, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_X, fromX, toX); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }