private void animateHeartButton(final FeedAdapter.CellFeedViewHolder holder) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator rotationAnim = ObjectAnimator.ofFloat(holder.btnLike, "rotation", 0f, 360f); rotationAnim.setDuration(300); rotationAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator bounceAnimX = ObjectAnimator.ofFloat(holder.btnLike, "scaleX", 0.2f, 1f); bounceAnimX.setDuration(300); bounceAnimX.setInterpolator(OVERSHOOT_INTERPOLATOR); ObjectAnimator bounceAnimY = ObjectAnimator.ofFloat(holder.btnLike, "scaleY", 0.2f, 1f); bounceAnimY.setDuration(300); bounceAnimY.setInterpolator(OVERSHOOT_INTERPOLATOR); bounceAnimY.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { holder.btnLike.setImageResource(R.drawable.ic_heart_red); } @Override public void onAnimationEnd(Animator animation) { heartAnimationsMap.remove(holder); dispatchChangeFinishedIfAllAnimationsEnded(holder); } }); animatorSet.play(bounceAnimX).with(bounceAnimY).after(rotationAnim); animatorSet.start(); heartAnimationsMap.put(holder, animatorSet); }
set.play(reduce).after(increment); return set;
animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim);
private void startProgressAnimation() { progressAnimStart = true; ObjectAnimator animator1 = ObjectAnimator.ofInt(mProgress, "progress", 0, 20); animator1.setDuration(800); ObjectAnimator animator2 = ObjectAnimator.ofInt(mProgress, "progress", 20, 80); animator2.setDuration(800); AnimatorSet animSet = new AnimatorSet(); animSet.play(animator2).after(animator1); animSet.setInterpolator(new DecelerateInterpolator()); animSet.start(); }
public AnimatorSetWrap after(View view, long duration, AnimatorListener listener, TimeInterpolator interpolator, String propertyName, float... values) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, propertyName, values).setDuration(duration); animator.setInterpolator(interpolator); if (listener != null) { animator.addListener(listener); } mAnimatorSetBuilder = mAnimatorSetBuilder.after(animator); return this; }
@Override public Animator createAnimationFor(AnimationBody animationBody, final View view) { final AnimatorSet animatorSet = new AnimatorSet(); final Animator animationClose = getCloseReveal(view); final Animator animationOpen = getOpenReveal(view); animationClose.addListener( SimpleAnimatorListener.forEnd(animation -> ((FloatingActionButton) view).setImageResource(newIconResId))); animatorSet.play(animationOpen).after(animationClose); return animatorSet; }
public AnimatorSetWrap after(long delay) { mAnimatorSetBuilder.after(delay); return this; }
public void startAnim(){ stopAnim(); ValueAnimator faceTBAnim=getFaceTopBottomAnim(); ValueAnimator faceLRAnim=getFaceLeftRightAnim(); AnimatorSet faceChangeAnim=getFaceChangeAnim(); set.play(getBlastAnim()).after(faceChangeAnim); set.play(faceChangeAnim).after(faceTBAnim); set.play(faceTBAnim).after(faceLRAnim); set.play(faceLRAnim).with(getHeadLineAnim()); set.start(); }
ValueAnimator fade = getStarFadeIn((ImageView) star.findViewById(R.id.fill)); bounce = getStarBounceIn((ImageView) star.findViewById(R.id.fill)); animations.play(fade).after(starStartDelay + STAR_FADE_IN_MS * i); animations.play(bounce).after(starStartDelay + STAR_FADE_IN_MS * i); animations.play(fadeInMenuItems).after(bounce); } else { animations.play(fadeInMenuItems).after(starStartDelay + STAR_FADE_IN_MS); animations.play(fadeInBestScore).after(fadeInBackground); animations.play(zoomBackDown).after(zoomUp); animations.play(fadeInShareImageAndFinalStars).after(zoomUp); animations.play(dropShareImageAndFinalStars).after(fadeInShareImageAndFinalStars); animations.start();
.before(getCheckedScaleYAnima(view)); if (afterTranXAnima != null) { animaBuilder.after(afterTranXAnima);
/** * 初始化所有动画 */ private void initAnimatorSet() { initLoadingAnimation(); initArcToCircleAnimation(); initOkAnimation(); animatorSet .play(animatorDrawArcToCircle) .before(animatorDrawOk) .after(animatorDrawLoading); animatorSet.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { if (loadingViewListener != null) { loadingViewListener.animationFinish(); } } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); }
/** * 初始化动画集 */ private void initAnimatorSet() { mAnimatorSet = new AnimatorSet(); mAnimatorSet.play(valueAnimators[1]).before(valueAnimators[2]).after(valueAnimators[0]); mAnimatorSet.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { mAnimatorSet.start(); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); }
/** * 开启动画 */ public void openAnimation() { if (!animatorSet.isRunning()) { animatorSet.play(floatAnimation()).after(inAnimation()).before(outAnimation()); // animatorSet.playTogether(floatAnimation()); animatorSet.start(); } }
set.play(scaleInX).with(scaleInY).after(scaleOutX); set.setInterpolator(new OvershootInterpolator(2));
mAnimatorSet1.play(mAnimatorSet).after(segment95Animator); mAnimatorSet = mAnimatorSet1;
@Override protected Animator createSoftwareExit() { final AnimatorSet set = new AnimatorSet(); // Linear exit after enter is completed. final ObjectAnimator exit = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 0); exit.setInterpolator(LINEAR_INTERPOLATOR); exit.setDuration(OPACITY_EXIT_DURATION); AnimatorsCompat.setAutoCancel(exit); //exit.setAutoCancel(true); final AnimatorSet.Builder builder = set.play(exit); // Linear "fast" enter based on current opacity. final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST); if (fastEnterDuration > 0) { final ObjectAnimator enter = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 1); enter.setInterpolator(LINEAR_INTERPOLATOR); enter.setDuration(fastEnterDuration); AnimatorsCompat.setAutoCancel(enter); //enter.setAutoCancel(true); builder.after(enter); } return set; }
private void changeMenuIconAnimation(final FloatingActionMenu menu) { AnimatorSet set=new AnimatorSet(); final ImageView v=menu.getMenuIconView(); ObjectAnimator scaleOutX=ObjectAnimator.ofFloat(v, "scaleX", 1.0f, 0.2f); ObjectAnimator scaleOutY=ObjectAnimator.ofFloat(v, "scaleY", 1.0f, 0.2f); ObjectAnimator scaleInX=ObjectAnimator.ofFloat(v, "scaleX", 0.2f, 1.0f); ObjectAnimator scaleInY=ObjectAnimator.ofFloat(v, "scaleY", 0.2f, 1.0f); scaleOutX.setDuration(50); scaleOutY.setDuration(50); scaleInX.setDuration(150); scaleInY.setDuration(150); scaleInX.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { v.setImageResource(menu.isOpened() ? R.drawable.ic_action_settings : R.drawable.ic_close); } }); set.play(scaleOutX).with(scaleOutY); set.play(scaleInX).with(scaleInY).after(scaleOutX); set.setInterpolator(new OvershootInterpolator(2)); menu.setIconToggleAnimatorSet(set); }
private void createCustomAnimation() { AnimatorSet set = new AnimatorSet(); ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 1.0f, 0.2f); ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 1.0f, 0.2f); ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 0.2f, 1.0f); ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 0.2f, 1.0f); scaleOutX.setDuration(50); scaleOutY.setDuration(50); scaleInX.setDuration(150); scaleInY.setDuration(150); scaleInX.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { menuGreen.getMenuIconView().setImageResource(menuGreen.isOpened() ? R.drawable.ic_close : R.drawable.ic_star); } }); set.play(scaleOutX).with(scaleOutY); set.play(scaleInX).with(scaleInY).after(scaleOutX); set.setInterpolator(new OvershootInterpolator(2)); menuGreen.setIconToggleAnimatorSet(set); }