List of usage examples for android.animation ObjectAnimator setDuration
@Override @NonNull public ObjectAnimator setDuration(long duration)
From source file:Main.java
public static void animateHeart(View view) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 1.2f); imgScaleUpYAnim.setDuration(300); ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 1.2f); imgScaleUpXAnim.setDuration(300);/*from ww w. ja v a 2 s .c o m*/ ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(view, "scaleY", 1.2f, 1.0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(view, "scaleX", 1.2f, 1.0f); imgScaleDownXAnim.setDuration(300); animatorSet.playTogether(imgScaleUpXAnim, imgScaleUpYAnim); animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpXAnim); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.clearAnimation(); animatorSet.start(); } }); animatorSet.start(); }
From source file:Main.java
/** * rotation y/* w w w . j a v a 2 s .com*/ * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void rotationY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * rotation x//from ww w. j a v a 2 s . c o m * * @param v * @param fromX * @param toX * @param duration * @param animatorListener */ public static void rotationX(View v, float fromX, float toX, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_X, fromX, toX); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * alpha//from w w w . ja v a2 s . co m * * @param v * @param fromAlpha * @param toAlpha * @param duration * @param animatorListener */ public static void alpha(View v, float fromAlpha, float toAlpha, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ALPHA, fromAlpha, toAlpha); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * translation y//from ww w .ja va 2s .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/*w ww . jav a 2 s . c o m*/ * * @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 createFadeOutAnimator(View view) { ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(250); return anim;/*from www . jav a 2 s.co m*/ }
From source file:Main.java
public static void fadeOutView(View view) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.8f, 0.5f, 0.3f, 0.0f); animator.setStartDelay(5000);//from ww w .ja va 2 s.c o m animator.setDuration(200); animator.start(); }
From source file:Main.java
public static Animator createFadeInAnimator(View view) { ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(250); return anim;/*from w w w . java 2s . c o m*/ }
From source file:Main.java
public static void showCardBackgroundColorAnimation(View view, int preColor, int currColor, int duration) { ObjectAnimator animator = ObjectAnimator.ofInt(view, "cardBackgroundColor", new int[] { preColor, currColor }); animator.setDuration(duration); animator.setEvaluator(new ArgbEvaluator()); animator.start();//from www . ja v a2 s . c o m }