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); }
animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim);
private void animate(Interpolator interpolator, long duration, ValueAnimator first, ValueAnimator... animators) { animator = new AnimatorSet(); animator.setDuration(duration); animator.setInterpolator(interpolator); animator.addListener(animatorListener); AnimatorSet.Builder builder = animator.play(first); for(ValueAnimator valueAnimator : animators) { builder.with(valueAnimator); } animator.start(); } }
indicatorRadius * 1.4f, indicatorRadius); animatorSet.play(lineAnimator).with(checkAnimator).before(indicatorAnimator); } else if (currentStep == previousStep - 1) {
animations.play(fadeOut).with(fadePauseButtonIn); animations.start();
animatorSet.setDuration(200); animatorSet.setInterpolator(new DecelerateInterpolator()); animatorSet.play(scaleAnima).with(tranXAnima); return animatorSet;
set1.play(ObjectAnimator .ofFloat(expandedImageView, View.X, startBounds.left)) .with(ObjectAnimator .ofFloat(expandedImageView, View.Y,startBounds.top)) .with(ObjectAnimator .ofFloat(expandedImageView, View.SCALE_X, startScale)) .with(ObjectAnimator .ofFloat(expandedImageView, View.SCALE_Y, startScale));
animatorSet.play(scaleX).with(scaleY); animatorSet.start();
@Override public void setUpAnimation() { ValueAnimator rotateAnimator = ValueAnimator.ofFloat(0, 360); rotateAnimator.setDuration(1500); rotateAnimator.setRepeatCount(ValueAnimator.INFINITE); rotateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rotate = (float)animation.getAnimatedValue(); if (invalidateListener != null) { invalidateListener.reDraw(); } } }); ValueAnimator scaleAnimator = ValueAnimator.ofFloat(1f, 0.8f, 1f); scaleAnimator.setDuration(1000); scaleAnimator.setRepeatCount(ValueAnimator.INFINITE); scaleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { scale = (float)animation.getAnimatedValue(); if (invalidateListener != null) { invalidateListener.reDraw(); } } }); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(rotateAnimator).with(scaleAnimator); animatorSet.start(); }
private Animator displayByDoubleStyle() { final View belowChild = getChildAt(0); final View aboveChild = getChildAt(1); ValueAnimator scaleAnima = ValueAnimator.ofFloat(1, 100); scaleAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float fraction = valueAnimator.getAnimatedFraction(); float scaleValue = 1 - (1 - CENTER_SCALE_RATE) * fraction; belowChild.setScaleX(scaleValue); belowChild.setScaleY(scaleValue); scaleValue = 1 - (1 - (CENTER_SCALE_RATE + OFFSET_SCALE_RATE)) * fraction; aboveChild.setScaleX(scaleValue); aboveChild.setScaleY(scaleValue); } }); float endTranX = width * (CENTER_SCALE_RATE + OFFSET_SCALE_RATE) / 2; ObjectAnimator tranXAnima = ObjectAnimator.ofFloat(aboveChild, "X", aboveChild.getX(), endTranX); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(200); animatorSet.setInterpolator(new DecelerateInterpolator()); animatorSet.play(scaleAnima).with(tranXAnima); return animatorSet; }
private void doStart(long delay) { ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight); ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight); ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator); animatorSet.setDuration(800); animatorSet.setStartDelay(delay); animatorSet.start(); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { topMaskView.setVisibility(View.GONE); bottomMaskView.setVisibility(View.GONE); maskReLayout.setVisibility(View.GONE); funGameView.postStatus(FunGameView.STATUS_GAME_PLAY); } }); }
@NonNull private AnimatorSet singleStyleAnimator(View view) { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(getCheckedScaleXAnima(view)) .with(getCheckedScaleYAnima(view)); return animatorSet; }
@Override protected Animator createSoftwareEnter(boolean fast) { // Bounded ripples don't have enter animations. if (mIsBounded) { return null; } final int duration = (int) (1000 * Math.sqrt(mTargetRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5); final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1); AnimatorsCompat.setAutoCancel(tweenRadius); // tweenRadius.setAutoCancel(true); tweenRadius.setDuration(duration); tweenRadius.setInterpolator(LINEAR_INTERPOLATOR); tweenRadius.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator tweenOrigin = ObjectAnimator.ofFloat(this, TWEEN_ORIGIN, 1); AnimatorsCompat.setAutoCancel(tweenOrigin); // tweenOrigin.setAutoCancel(true); tweenOrigin.setDuration(duration); tweenOrigin.setInterpolator(LINEAR_INTERPOLATOR); tweenOrigin.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1); AnimatorsCompat.setAutoCancel(opacity); // opacity.setAutoCancel(true); opacity.setDuration(OPACITY_ENTER_DURATION_FAST); opacity.setInterpolator(LINEAR_INTERPOLATOR); final AnimatorSet set = new AnimatorSet(); set.play(tweenOrigin).with(tweenRadius).with(opacity); 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); }
private Animator createAnimatorOut() { ObjectAnimator alphaAnima = ObjectAnimator.ofFloat(null, "alpha", .5f, 1.f); ObjectAnimator scaleX = ObjectAnimator.ofFloat(null, "scaleX", 1.0f, 1.8f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(null, "scaleY", 1.0f, 1.8f); AnimatorSet animatorOut = new AnimatorSet(); animatorOut.play(alphaAnima).with(scaleX).with(scaleY); return animatorOut; }
@Override public void onStartAnimator(@NonNull RefreshLayout layout, int height, int maxDragHeight) { super.onStartAnimator(layout, height, maxDragHeight); final View topView = mMaskViewTop; final View shadowView = mShadowView; final View bottomView = mMaskViewBottom; final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(ObjectAnimator.ofFloat(topView, "translationY", topView.getTranslationY(), -mHalfHeaderHeight)) .with(ObjectAnimator.ofFloat(bottomView, "translationY", bottomView.getTranslationY(), mHalfHeaderHeight)) .with(ObjectAnimator.ofFloat(shadowView, "alpha", shadowView.getAlpha(), 0)); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { topView.setVisibility(View.GONE); bottomView.setVisibility(View.GONE); shadowView.setVisibility(View.GONE); postStatus(FunGameView.STATUS_GAME_PLAY); } }); animatorSet.setDuration(800); animatorSet.setStartDelay(200); animatorSet.start(); }