@Override protected void showAfter() { View rootView = getRootView(); AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator alpha = ObjectAnimator.ofFloat(rootView, "alpha", 0, 1); ObjectAnimator translation = ObjectAnimator.ofFloat(rootView, "translationY", 300, 0); animatorSet.playTogether(alpha, translation); animatorSet.setDuration(1000); animatorSet.setInterpolator(new AccelerateInterpolator()); animatorSet.start(); }
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(); } }
@Override public void translate(InfoBean bean, ExposeView parent, View child) { set.playTogether( ObjectAnimator.ofFloat(child, "scaleY", 1) ); set.setInterpolator(new AccelerateInterpolator()); set.setDuration(showDuration).start(); }
mFlyAnimator.end(); mFlyView.clearAnimation(); AnimatorSet flyDownAnim = new AnimatorSet(); flyDownAnim.setDuration(800); ObjectAnimator transX1 = ObjectAnimator.ofFloat(mFlyView, "translationX", mFlyView.getTranslationX(), offDistX); ObjectAnimator transY1 = ObjectAnimator.ofFloat(mFlyView, "translationY", mFlyView.getTranslationY(), offDistY); ObjectAnimator rotationX1 = ObjectAnimator.ofFloat(mFlyView, "rotationX", mFlyView.getRotationX(), 30); rotation1.setInterpolator(new AccelerateInterpolator()); flyDownAnim.playTogether(transX1, transY1 , rotation1 , rotationX1 , ObjectAnimator.ofFloat(mFlyView, "scaleY", mFlyView.getScaleY(), 0.9f) ); flyDownAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { AnimatorSet flyInAnim = new AnimatorSet(); flyInAnim.setDuration(800); flyInAnim.setInterpolator(new DecelerateInterpolator()); ObjectAnimator tranX2 = ObjectAnimator.ofFloat(mFlyView, "translationX", offDistX, 0); ObjectAnimator tranY2 = ObjectAnimator.ofFloat(mFlyView, "translationY", offDistY, 0); ObjectAnimator rotationX2 = ObjectAnimator.ofFloat(mFlyView, "rotationX", 30, 0); flyInAnim.playTogether(tranX2, tranY2 , rotationX2 , ObjectAnimator.ofFloat(mFlyView, "scaleX", 0.9f, 1f)
@Override @NonNull protected Animator getAnimator(@NonNull ViewGroup container, View from, View to, boolean isPush, boolean toAddedToContainer) { AnimatorSet animator = new AnimatorSet(); if (to != null) { float start = toAddedToContainer ? 0 : to.getAlpha(); animator.play(ObjectAnimator.ofFloat(to, View.ALPHA, start, 1)); } if (from != null) { animator.play(ObjectAnimator.ofFloat(from, View.ALPHA, 0)); animator.play(ObjectAnimator.ofFloat(from, View.SCALE_X, 0.8f)); animator.play(ObjectAnimator.ofFloat(from, View.SCALE_Y, 0.8f)); } return animator; }
@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(); }
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); }
@Nullable public static Animator mergeAnimators(@Nullable Animator animator1, @Nullable Animator animator2) { if (animator1 == null) { return animator2; } else if (animator2 == null) { return animator1; } else { AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animator1, animator2); return animatorSet; } }
private void animateShutter() { vShutter.setVisibility(View.VISIBLE); vShutter.setAlpha(0.f); ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f); alphaInAnim.setDuration(100); alphaInAnim.setStartDelay(100); alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f); alphaOutAnim.setDuration(200); alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playSequentially(alphaInAnim, alphaOutAnim); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { vShutter.setVisibility(View.GONE); } }); animatorSet.start(); }
public static void performAnimation(View view) { AnimatorSet animatorSet = new AnimatorSet(); ValueAnimator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, 0.6f); scaleX.setRepeatCount(ValueAnimator.INFINITE); scaleX.setRepeatMode(ValueAnimator.REVERSE); scaleX.setDuration(1000); ValueAnimator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.6f); scaleY.setRepeatCount(ValueAnimator.INFINITE); scaleY.setRepeatMode(ValueAnimator.REVERSE); scaleY.setDuration(1000); animatorSet.playTogether(scaleX, scaleY); animatorSet.start(); }
setAnimation(view); animatorSet.setDuration(duration); if (interpolator != null) { animatorSet.setInterpolator(interpolator); animatorSet.setStartDelay(delay); animatorSet.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { animatorSet.start();
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); }
@Override public void setAnimation(View view) { animatorSet.playTogether(// // ObjectAnimator.ofFloat(view, "rotationX", -90, 0)); ObjectAnimator.ofFloat(view, "rotationX", 90, 0)); } }
animatorRadarScale.addUpdateListener(new AnimatorUpdater(PROPERTY_RADAR_SCALE)); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playSequentially(animatorDotAlpha, animatorRadarScale, mRadarAnimator); animatorSet.start();
@Override public void run() { calculate(); animatorSet.start(); } });
AnimatorSet transition = new AnimatorSet(); ReflowData startData = (ReflowData) startValues.values.get(PROPNAME_DATA); ReflowData endData = (ReflowData) endValues.values.get(PROPNAME_DATA); transition.playTogether( createRunAnimators(view, startData, endData, startText, endText, runs)); transition.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) {
/** * @param currentContentIcon currently displayed view with icon * @param newContentIcon newly created and prepared view to display * @return animator set with this animation */ protected AnimatorSet createContentIconShowAnimation(final View currentContentIcon, final View newContentIcon) { int positionDeltaPx = dpToPixels(CONTENT_ICON_POS_DELTA_Y_DP); AnimatorSet animations = new AnimatorSet(); Animator currentContentMoveUp = ObjectAnimator.ofFloat(currentContentIcon, "y", 0, -positionDeltaPx); currentContentMoveUp.setDuration(ANIM_CONTENT_ICON_HIDE_TIME); currentContentMoveUp.addListener(new AnimatorEndListener() { @Override public void onAnimationEnd(Animator animation) { mContentIconContainer.removeView(currentContentIcon); } }); Animator currentContentFadeOut = ObjectAnimator.ofFloat(currentContentIcon, "alpha", 1, 0); currentContentFadeOut.setDuration(ANIM_CONTENT_ICON_HIDE_TIME); animations.playTogether(currentContentMoveUp, currentContentFadeOut); Animator newContentMoveUp = ObjectAnimator.ofFloat(newContentIcon, "y", positionDeltaPx, 0); newContentMoveUp.setDuration(ANIM_CONTENT_ICON_SHOW_TIME); Animator newContentFadeIn = ObjectAnimator.ofFloat(newContentIcon, "alpha", 0, 1); newContentFadeIn.setDuration(ANIM_CONTENT_ICON_SHOW_TIME); animations.playTogether(newContentMoveUp, newContentFadeIn); animations.setInterpolator(new DecelerateInterpolator()); return animations; }
private Animator getAnimator(LeafHolder target, RectF leafFlyRect, float progress) { ValueAnimator bezierValueAnimator = getBezierValueAnimator(target, leafFlyRect, progress); AnimatorSet finalSet = new AnimatorSet(); finalSet.playSequentially(bezierValueAnimator); finalSet.setInterpolator(INTERPOLATORS[mRandom.nextInt(INTERPOLATORS.length)]); finalSet.setTarget(target); return finalSet; }
opacity.setInterpolator(LINEAR_INTERPOLATOR); final AnimatorSet set = new AnimatorSet(); set.play(tweenOrigin).with(tweenRadius).with(opacity); set.addListener(mAnimationListener);