List of usage examples for android.animation ObjectAnimator setStartDelay
@Override public void setStartDelay(long startDelay)
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); animator.setDuration(200);/*from www . j a v a 2 s.com*/ 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 *//* w w w . jav a 2 s .com*/ 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 *//* ww w. ja 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 ObjectAnimator animateTranslateX(final View view, float initialX, float finalX, int duration, int delay) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "TranslationX", initialX, finalX); animator.setDuration(duration);/* w w w .j av a 2s . c om*/ if (delay > 0) animator.setStartDelay(delay); // go for it animator.start(); return animator; }
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);// ww w . j av a 2 s .com 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 Animator moveScrollViewToX(View view, int toX, int time, int delayTime, boolean isStart) { ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "scrollX", new int[] { toX }); objectAnimator.setDuration(time);// ww w . ja v a 2 s. c o m objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.setStartDelay(delayTime); if (isStart) objectAnimator.start(); return objectAnimator; }
From source file:Main.java
public static void animFlicker(View view, long duration, int repeatCount) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator alphaIn = ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f); ObjectAnimator alphaOut = ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.0f); alphaIn.setDuration(duration);/* www .ja va 2 s . c o m*/ alphaIn.setStartDelay(duration); alphaOut.setDuration(duration); alphaOut.setRepeatCount(repeatCount); alphaIn.setRepeatCount(repeatCount); animatorSet.playTogether(alphaOut, alphaIn); animatorSet.start(); }
From source file:Main.java
public static void animatePhotoLike(final View vBgLike, final View ivLike) { vBgLike.setVisibility(View.VISIBLE); ivLike.setVisibility(View.VISIBLE); vBgLike.setScaleY(0.1f);/* w w w . j av a2 s.co m*/ vBgLike.setScaleX(0.1f); vBgLike.setAlpha(1f); ivLike.setScaleY(0.1f); ivLike.setScaleX(0.1f); android.animation.AnimatorSet animatorSet = new android.animation.AnimatorSet(); android.animation.ObjectAnimator bgScaleYAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "scaleY", 0.1f, 1f); bgScaleYAnim.setDuration(200); bgScaleYAnim.setInterpolator(DECELERATE_INTERPOLATOR); android.animation.ObjectAnimator bgScaleXAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "scaleX", 0.1f, 1f); bgScaleXAnim.setDuration(200); bgScaleXAnim.setInterpolator(DECELERATE_INTERPOLATOR); android.animation.ObjectAnimator bgAlphaAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleUpYAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleY", 0.1f, 1f); imgScaleUpYAnim.setDuration(300); imgScaleUpYAnim.setInterpolator(DECELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleUpXAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleX", 0.1f, 1f); imgScaleUpXAnim.setDuration(300); imgScaleUpXAnim.setInterpolator(DECELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleDownYAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleY", 1f, 0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleDownXAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "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 android.animation.AnimatorListenerAdapter() { @Override public void onAnimationEnd(android.animation.Animator animation) { vBgLike.setVisibility(View.INVISIBLE); ivLike.setVisibility(View.INVISIBLE); } }); animatorSet.start(); }
From source file:Main.java
public static void animatePhotoLike(final View vBgLike, final View ivLike) { vBgLike.setVisibility(View.VISIBLE); ivLike.setVisibility(View.VISIBLE); vBgLike.setScaleY(0.1f);//from w ww . ja v a2s. co m vBgLike.setScaleX(0.1f); vBgLike.setAlpha(1f); ivLike.setScaleY(0.1f); ivLike.setScaleX(0.1f); android.animation.AnimatorSet animatorSet = new android.animation.AnimatorSet(); android.animation.ObjectAnimator bgScaleYAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "scaleY", 0.1f, 1f); bgScaleYAnim.setDuration(200); bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); android.animation.ObjectAnimator bgScaleXAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "scaleX", 0.1f, 1f); bgScaleXAnim.setDuration(200); bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); android.animation.ObjectAnimator bgAlphaAnim = android.animation.ObjectAnimator.ofFloat(vBgLike, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleUpYAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleY", 0.1f, 1f); imgScaleUpYAnim.setDuration(300); imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleUpXAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleX", 0.1f, 1f); imgScaleUpXAnim.setDuration(300); imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleDownYAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "scaleY", 1f, 0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); android.animation.ObjectAnimator imgScaleDownXAnim = android.animation.ObjectAnimator.ofFloat(ivLike, "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 android.animation.AnimatorListenerAdapter() { @Override public void onAnimationEnd(android.animation.Animator animation) { vBgLike.setVisibility(View.INVISIBLE); ivLike.setVisibility(View.INVISIBLE); } }); animatorSet.start(); }
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
public static void scaleIn(final View view, int delay) { view.setAlpha(0.0f);//w w w . ja v a 2s. c om view.setScaleX(0.0f); view.setScaleY(0.0f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator scaleInAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY); scaleInAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_in)); scaleInAnimation.setStartDelay(delay); scaleInAnimation.setInterpolator(EASE_IN_INTERPOLATOR); scaleInAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(Animator animation) { view.setAlpha(1.0f); view.setScaleX(1.0f); view.setScaleY(1.0f); } }); scaleInAnimation.start(); }