android.view.ViewPropertyAnimator类的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中android.view.ViewPropertyAnimator类的一些代码示例,展示了ViewPropertyAnimator类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator类的具体详情如下:
包路径:android.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator

ViewPropertyAnimator介绍

暂无

代码示例

代码示例来源:origin: xinghongfei/LookLook

private void viewEnterAnimationNest(View view, float offset, Interpolator interp) {
  view.setTranslationY(-offset);
  view.animate()
      .translationY(0f)
      .alpha(1f)
      .setDuration(50L)
      .setInterpolator(interp)
      .setListener(null)
      .start();
}

代码示例来源:origin: seven332/EhViewer

private void hideActionFab() {
  if (null != mFabLayout && STATE_NORMAL == mState && mShowActionFab) {
    mShowActionFab = false;
    View fab = mFabLayout.getPrimaryFab();
    fab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mActionFabAnimatorListener)
        .setDuration(ANIMATE_TIME).setStartDelay(0L)
        .setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

private void addAnimate(SmartViewHolder holder, int postion) {
  if (mOpenAnimationEnable && mLastPosition < postion) {
    holder.itemView.setAlpha(0);
    holder.itemView.animate().alpha(1).start();
    mLastPosition = postion;
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    int scrollRange = appBarLayout.getTotalScrollRange();
    float fraction = 1f * (scrollRange + verticalOffset) / scrollRange;
    if (fraction < 0.1 && misAppbarExpand) {
      misAppbarExpand = false;
      fab.animate().scaleX(0).scaleY(0);
    }
    if (fraction > 0.8 && !misAppbarExpand) {
      misAppbarExpand = true;
      fab.animate().scaleX(1).scaleY(1);
    }
  }
});

代码示例来源:origin: bluelinelabs/Conductor

@Override
public void onStopNestedScroll(View child) {
  if (Math.abs(totalDrag) >= dragDismissDistance) {
    dispatchDismissCallback();
  } else { // settle back to natural position
    animate()
        .translationY(0f)
        .scaleX(1f)
        .scaleY(1f)
        .setDuration(200L)
        .setInterpolator(new FastOutSlowInInterpolator())
        .setListener(null)
        .start();
    totalDrag = 0;
    draggingDown = draggingUp = false;
    dispatchDragCallback(0f, 0f, 0f, 0f);
  }
}

代码示例来源:origin: nickbutcher/plaid

private void showFab() {
  fab.setAlpha(0f);
  fab.setScaleX(0f);
  fab.setScaleY(0f);
  fab.setTranslationY(fab.getHeight() / 2);
  fab.animate()
      .alpha(1f)
      .scaleX(1f)
      .scaleY(1f)
      .translationY(0f)
      .setDuration(300L)
      .setInterpolator(AnimUtils.getLinearOutSlowInInterpolator(this))
      .start();
}

代码示例来源:origin: janishar/PlaceHolderView

protected static <V extends View>void itemAnimFadeAsc(V view, float alphaInitial, float alphaFinal, float factor, int duration){
    view.setAlpha(alphaInitial);
    view.animate()
        .alpha(alphaFinal)
        .setInterpolator(new AccelerateInterpolator(factor))
        .setDuration(duration)
        .start();
  }
}

代码示例来源:origin: TeamNewPipe/NewPipe

public static void animateRotation(final View view, long duration, int targetRotation) {
  if (DEBUG) {
    Log.d(TAG, "animateRotation: duration = [" + duration + "], from " + view.getRotation() + " to → " + targetRotation + " in: " + view);
  }
  view.animate().setListener(null).cancel();
  view.animate().rotation(targetRotation).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator())
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationCancel(Animator animation) {
          view.setRotation(targetRotation);
        }
        @Override
        public void onAnimationEnd(Animator animation) {
          view.setRotation(targetRotation);
        }
      }).start();
}

代码示例来源:origin: ankidroid/Anki-Android

private void hideViewWithAnimation(final View view) {
  view.animate()
      .alpha(0f)
      .setDuration(ANIMATION_DURATION)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          view.setVisibility(View.GONE);
        }
      });
}

代码示例来源:origin: frogermcs/InstaMaterial

private void startIntroAnimation() {
  ViewCompat.setElevation(getToolbar(), 0);
  contentRoot.setScaleY(0.1f);
  contentRoot.setPivotY(drawingStartLocation);
  llAddComment.setTranslationY(200);
  contentRoot.animate()
      .scaleY(1)
      .setDuration(200)
      .setInterpolator(new AccelerateInterpolator())
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          ViewCompat.setElevation(getToolbar(), Utils.dpToPx(8));
          animateContent();
        }
      })
      .start();
}

代码示例来源:origin: janishar/PlaceHolderView

protected static <V extends View>void itemAnimFromXDesc(V view, float xInit, float xFinal, float factor, int duration){
  view.setTranslationX(xInit);
  view.animate()
      .translationX(xFinal)
      .setInterpolator(new DecelerateInterpolator(factor))
      .setDuration(duration)
      .start();
}

代码示例来源:origin: niorgai/StatusBarCompat

@Override
  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getScrimVisibleHeightTrigger()) {
      if (statusView.getAlpha() == 0) {
        statusView.animate().cancel();
        statusView.animate().alpha(1f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    } else {
      if (statusView.getAlpha() == 1) {
        statusView.animate().cancel();
        statusView.animate().alpha(0f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    }
  }
});

代码示例来源:origin: seven332/EhViewer

private void showProgress(boolean animation) {
  if (null != mProgress && View.VISIBLE != mProgress.getVisibility()) {
    if (animation) {
      mProgress.setAlpha(0.0f);
      mProgress.setVisibility(View.VISIBLE);
      mProgress.animate().alpha(1.0f).setDuration(500).start();
    } else {
      mProgress.setAlpha(1.0f);
      mProgress.setVisibility(View.VISIBLE);
    }
  }
}

代码示例来源:origin: Yalantis/uCrop

@Override
public void onLoadComplete() {
  mUCropView.animate().alpha(1).setDuration(300).setInterpolator(new AccelerateInterpolator());
  mBlockingView.setClickable(false);
  mShowLoader = false;
  supportInvalidateOptionsMenu();
}

代码示例来源:origin: wangdan/AisenWeiBo

protected void morph(float endX, float endY, Side side, float arcDegrees, float scaleFactor,
    long duration, AnimationListener listener) {
  // Move the FAB
  startArcAnim(fab, endX, endY, arcDegrees, side, duration, interpolator, listener);
  // Scale the size of the FAB
  fab.animate().scaleXBy(scaleFactor).scaleYBy(scaleFactor).setDuration(duration)
      .setInterpolator(interpolator).start();
}

代码示例来源:origin: LaiFeng-Android/SopCastComponent

public void animateWorking(long duration) {
    animate().rotationBy(45.0f).setDuration(duration).setInterpolator(
        new DecelerateInterpolator()).start();
  }
}

代码示例来源:origin: avjinder/Minimal-Todo

@Override
      public void show() {

        mAddToDoItemFAB.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
//                mAddToDoItemFAB.animate().translationY(0).setInterpolator(new AccelerateInterpolator(2.0f)).start();
      }

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void run() {
  if (fadingOut) {
   fadee.animate().alpha(0).setDuration(PERIOD);
   fadee.setText(R.string.fading_out);
  }
  else {
   fadee.animate().alpha(1).setDuration(PERIOD);
   fadee.setText(R.string.coming_back);
  }
  
  fadingOut=!fadingOut;
  
  fadee.postDelayed(this, PERIOD);
 }
}

代码示例来源:origin: wangdan/AisenWeiBo

private void setTranslation(float translationX, float translationY) {
  animate().setInterpolator(getInterpolator()).setDuration(FAB_ANIM_DURATION)
      .translationX(translationX).translationY(translationY);
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

protected void hideOrShowToolbar() {
  toolbar.animate()
      .alpha(mIsToolBarHidden ? 1.0f : 0.0f)
      .setInterpolator(new DecelerateInterpolator(2))
      .start();
  mIsToolBarHidden = !mIsToolBarHidden;
}

相关文章