List of usage examples for android.animation AnimatorSet AnimatorSet
public AnimatorSet()
From source file:Main.java
@NonNull private static AnimatorSet createDisappearAnim(View btnPanel, View recyclerView, View locationTxt, View headline) {/* w w w. j av a2 s . co m*/ AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0); Animator anim1_2 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0); Animator anim1_3 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0); Animator anim1_4 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 1, 0); setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Interpolator interpolator2 = new DecelerateInterpolator(); Animator anim2_1 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 1, 0); Animator anim2_2 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_X, 1f, 2f); Animator anim2_3 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_Y, 1f, 2f); anim2_1.setInterpolator(interpolator2); anim2_2.setInterpolator(interpolator2); anim2_3.setInterpolator(interpolator2); setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3); animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1); return animAll; }
From source file:Main.java
public static Animator createXTransition(View view, boolean enter) { ObjectAnimator x;/* ww w . ja va2s. co m*/ ObjectAnimator y; if (enter) { x = ObjectAnimator.ofFloat(view, "translationX", 1f, 0f); y = ObjectAnimator.ofFloat(view, "translationY", 1f, 0f); } else { x = ObjectAnimator.ofFloat(view, "translationX", 0f, -1f); y = ObjectAnimator.ofFloat(view, "translationY", 0f, -1f); } AnimatorSet set = new AnimatorSet(); set.playTogether(x, y); return set; }
From source file:Main.java
public static void animateHeartButton(final View v) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator rotationAnim = ObjectAnimator.ofFloat(v, "rotation", 0f, 360f); rotationAnim.setDuration(300);/* ww w . j a va 2 s .co m*/ rotationAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator bounceAnimX = ObjectAnimator.ofFloat(v, "scaleX", 0.2f, 1f); bounceAnimX.setDuration(300); bounceAnimX.setInterpolator(OVERSHOOT_INTERPOLATOR); ObjectAnimator bounceAnimY = ObjectAnimator.ofFloat(v, "scaleY", 0.2f, 1f); bounceAnimY.setDuration(300); bounceAnimY.setInterpolator(OVERSHOOT_INTERPOLATOR); bounceAnimY.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { } }); animatorSet.play(bounceAnimX).with(bounceAnimY).after(rotationAnim); animatorSet.start(); }
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();// www . j av 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 animatePhotoLike(final ImageView likeBg, final ImageView likeIcon) { likeBg.setVisibility(View.VISIBLE); likeIcon.setVisibility(View.VISIBLE); likeBg.setScaleY(0.1f);/*from w w w . j a v a2 s . c o m*/ likeBg.setScaleX(0.1f); likeBg.setAlpha(1f); likeIcon.setScaleY(0.1f); likeIcon.setScaleX(0.1f); AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(likeBg, "scaleY", 0.1f, 1f); bgScaleYAnim.setDuration(200); bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(likeBg, "scaleX", 0.1f, 1f); bgScaleXAnim.setDuration(200); bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(likeBg, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 0.1f, 1f); imgScaleUpYAnim.setDuration(300); imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 0.1f, 1f); imgScaleUpXAnim.setDuration(300); imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 1f, 0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 1f, 0f); imgScaleDownXAnim.setDuration(300); imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR); animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim); animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { resetLikeAnimationState(likeBg, likeIcon); } }); animatorSet.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();/* w w w . j a va 2 s . co 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 AnimatorSet createAnimatorSet() { AnimatorSet anim = new AnimatorSet(); cancelOnDestroyActivity(anim); return anim; }
From source file:Main.java
@NonNull private static AnimatorSet createRevealAnimation(View headline, View image, View startBtn, View pick1, View pick2) {//from w w w . j a v a 2 s . com AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 0, 1, 1); Animator anim1_2 = ObjectAnimator.ofFloat(headline, View.TRANSLATION_Y, -headline.getBottom(), 60, 0); Animator anim1_3 = ObjectAnimator.ofFloat(headline, View.SCALE_X, 0.1f, 0.475f, 1); Animator anim1_4 = ObjectAnimator.ofFloat(headline, View.SCALE_Y, 0.1f, 0.475f, 1); setBatchTiming(1000, 0, anim1_1, anim1_2, anim1_3, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 0, 1); Animator anim2_2 = ObjectAnimator.ofFloat(image, View.TRANSLATION_Y, image.getHeight() / 4, 0); setBatchTiming(800, 0, anim2_1, anim2_2); animAll.play(anim2_1).with(anim2_2).after(anim1_1); Animator anim3_1 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1); Animator anim3_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1); Animator anim3_3 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 0, 1); Animator anim3_4 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 0, 1); setBatchTiming(1800, 0, anim3_1, anim3_2, anim3_3, anim3_4); animAll.play(anim3_1).with(anim3_2).with(anim3_3).with(anim3_4).after(anim1_1); return animAll; }
From source file:Main.java
@NonNull private static AnimatorSet createDisappearAnim(View startBtn, View pick1, View pick2, View image, View headline) {//from w w w .j a v a 2 s . c o m AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0); Animator anim1_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0); Animator anim1_3 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 1, 0); Animator anim1_4 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 1, 0); Animator anim1_5 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 1, 0); setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_5); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4).with(anim1_5); Interpolator interpolator2 = new DecelerateInterpolator(); Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 1, 0); Animator anim2_2 = ObjectAnimator.ofFloat(image, View.SCALE_X, 1f, 2f); Animator anim2_3 = ObjectAnimator.ofFloat(image, View.SCALE_Y, 1f, 2f); anim2_1.setInterpolator(interpolator2); anim2_2.setInterpolator(interpolator2); anim2_3.setInterpolator(interpolator2); setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3); animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1); return animAll; }
From source file:com.microsoft.azure.engagement.ProductDiscountActivity.java
/** * Method that animates a view/*from ww w . j ava 2 s .c o m*/ * * @param view The view to animate * @param objectAnimator The objectAnimator to play * @param isVisible The visibility of the view at the end of the animation */ public static final void performAnimation(final View view, ObjectAnimator objectAnimator, final boolean isVisible) { view.setVisibility(View.VISIBLE); objectAnimator.setDuration(300); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(objectAnimator); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE); } }); animatorSet.start(); }