List of usage examples for android.animation AnimatorSet setDuration
@Override public AnimatorSet setDuration(long duration)
From source file:Main.java
public static void changeImageSize(ImageView image, float fromScale, float toScale) { ObjectAnimator scaleX;// www. j av a 2 s . c o m ObjectAnimator scaleY; scaleX = ObjectAnimator.ofFloat(image, "scaleX", fromScale, toScale); scaleY = ObjectAnimator.ofFloat(image, "scaleY", fromScale, toScale); AnimatorSet set = new AnimatorSet(); set.setDuration(150); set.playTogether(scaleX, scaleY); set.start(); }
From source file:Main.java
public static void playTogether(ObjectAnimator... animator) { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(200); animatorSet.playTogether(animator);//from w w w . j ava 2s. c o m animatorSet.start(); }
From source file:Main.java
public static void animateSpinIn(View view, long duration, Animator.AnimatorListener listener) { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(duration); animatorSet.playTogether(ObjectAnimator.ofFloat(view, "rotation", -200, 0), ObjectAnimator.ofFloat(view, "alpha", 0, 1)); animatorSet.start();//from ww w . ja va 2s.c o m }
From source file:Main.java
@NonNull public static AnimatorSet getAnimatorSet(long duration, Interpolator interpolator) { final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(duration); if (interpolator != null) { animatorSet.setInterpolator(interpolator); }//from w ww . jav a 2s .co m return animatorSet; }
From source file:Main.java
private static AnimatorSet buildMenuAnimation(View target, float alpha, int animationDuration) { AnimatorSet alphaAnimation = new AnimatorSet(); alphaAnimation.playTogether(ObjectAnimator.ofFloat(target, "alpha", alpha)); alphaAnimation.setDuration(animationDuration); return alphaAnimation; }
From source file:Main.java
public static void scaleHide(final View view, final Runnable rWhenEnd) { if (view.getWindowToken() == null) { view.setVisibility(View.INVISIBLE); if (rWhenEnd != null) { rWhenEnd.run();/* w w w . ja v a2 s .c om*/ } return; } ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1f, 0f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1f, 0f); AnimatorSet set = new AnimatorSet(); set.playTogether(scaleX, scaleY); set.setDuration(DURATION_SHORT); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.INVISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationCancel(Animator animation) { view.setVisibility(View.INVISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationRepeat(Animator animation) { } }); set.start(); }
From source file:Main.java
public static void scaleShow(final View view, final Runnable rWhenEnd) { if (view.getVisibility() == View.VISIBLE) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run();/*from w w w. j a v a 2 s . c o m*/ } return; } if (view.getWindowToken() == null) { view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { scaleShow(view); } @Override public void onViewDetachedFromWindow(View v) { } }); } ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f); AnimatorSet set = new AnimatorSet(); set.playTogether(scaleX, scaleY); set.setDuration(DURATION_SHORT); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationCancel(Animator animation) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationRepeat(Animator animation) { } }); set.start(); }
From source file:Main.java
public static void animatePulse(final View target) { AnimatorSet set = new AnimatorSet(); set.playTogether(ObjectAnimator.ofFloat(target, "scaleY", 1, 1.1f, 1), ObjectAnimator.ofFloat(target, "scaleX", 1, 1.1f, 1)); set.setDuration(1000); set.start();// www. j a v a2 s . c o m }
From source file:Main.java
public static void runFlipHorizonAnimation(@NonNull View view, long duration, final Runnable rWhenEnd) { view.setAlpha(0);/*from w w w. j a v a2 s . c o m*/ AnimatorSet set = new AnimatorSet(); ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(view, "rotationY", -180f, 0f); ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); set.setDuration(duration); set.playTogether(objectAnimator1, objectAnimator2); if (rWhenEnd != null) set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { rWhenEnd.run(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); set.start(); }
From source file:Main.java
public static void animateScaleIn(View view, long duration, Animator.AnimatorListener listener) { view.setScaleX(0f);/*from www .j ava2 s . c o m*/ view.setScaleY(0f); view.setVisibility(View.VISIBLE); AnimatorSet scaleSet = new AnimatorSet(); scaleSet.playTogether(ObjectAnimator.ofFloat(view, View.SCALE_X, 1f), ObjectAnimator.ofFloat(view, View.SCALE_Y, 1f)); scaleSet.setInterpolator(new AccelerateDecelerateInterpolator()); scaleSet.setDuration(duration); if (listener != null) { scaleSet.addListener(listener); } scaleSet.start(); //return scaleSet; }