@Override public Animator setDuration(long durationMS) { mAnimator.setDuration(durationMS); return this; }
@Override public Animator setDuration(long durationMS) { mAnimator.setDuration(durationMS); return this; }
@Override public Animator setDuration(long durationMS) { mAnimator.setDuration(durationMS); return this; }
@Override public Animator setDuration(long durationMS) { mAnimator.setDuration(durationMS); return this; }
@Override public Animator setDuration(long durationMS) { mAnimator.setDuration(durationMS); return this; }
@Override public void setDuration(int duration) { Animator a = mAnimator.get(); if(a != null) { a.setDuration(duration); } }
private void circularRevealActivity() { int cx = rootLayout.getWidth() / 2; int cy = rootLayout.getHeight() / 2; float finalRadius = Math.max(rootLayout.getWidth(), rootLayout.getHeight()); // create the animator for this view (the start radius is zero) Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, 0, finalRadius); circularReveal.setDuration(1000); // make the view visible and start the animation rootLayout.setVisibility(View.VISIBLE); circularReveal.start(); }
/** * 开始动画 * * @param anim * @param index */ protected void startAnim(Animator anim, int index) { anim.setDuration(mDuration).start(); anim.setInterpolator(mInterpolator); }
/** * set anim to start when loading * * @param anim * @param index */ protected void startAnim(Animator anim, int index) { anim.setDuration(mDuration).start(); anim.setInterpolator(mInterpolator); }
private void toggle() { if (animator != null) { animator.cancel(); } animator = ObjectAnimator.ofFloat(this, PROGRESS, isPlay ? 1.0F : 0.0F, isPlay ? 0.0F : 1.0F); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { isPlay = !isPlay; } }); animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(200); animator.start(); }
private boolean createCircularReveal() { if (mColorBg == null) { return false; } int w = mColorBg.getWidth(); int h = mColorBg.getHeight(); if (ViewCompat.isAttachedToWindow(mColorBg) && w != 0 && h != 0) { ViewAnimationUtils.createCircularReveal(mColorBg, w / 2, h / 2, 0, (float) Math.hypot(w / 2, h / 2)).setDuration(300).start(); return true; } else { return false; } }
protected Animator createContentCenteringVerticalAnimation(View newContentText, View newContentIcon) { newContentText.measure(View.MeasureSpec.makeMeasureSpec(mContentCenteredContainer.getWidth(), View.MeasureSpec.AT_MOST), -2); int measuredContentTextHeight = newContentText.getMeasuredHeight(); newContentIcon.measure(-2, -2); int measuredContentIconHeight = newContentIcon.getMeasuredHeight(); int newHeightOfContent = measuredContentIconHeight + measuredContentTextHeight + ((ViewGroup.MarginLayoutParams) mContentTextContainer.getLayoutParams()).topMargin; Animator centerContentAnimation = ObjectAnimator.ofFloat(mContentCenteredContainer, "y", mContentCenteredContainer.getY(), (mContentRootLayout.getHeight() - newHeightOfContent) / 2); centerContentAnimation.setDuration(ANIM_CONTENT_CENTERING_TIME); centerContentAnimation.setInterpolator(new DecelerateInterpolator()); return centerContentAnimation; }
private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) { this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music; View view = findViewById(R.id.content_frame); int finalRadius = Math.max(view.getWidth(), view.getHeight()); Animator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION); findViewById(R.id.content_overlay).setBackground(new BitmapDrawable(getResources(), screenShotable.getBitmap())); animator.start(); ContentFragment contentFragment = ContentFragment.newInstance(this.res); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit(); return contentFragment; }
animator.setDuration(500);
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { mAdapter.onBindViewHolder(holder, position); int adapterPosition = holder.getAdapterPosition(); if (!isFirstOnly || adapterPosition > mLastPosition) { for (Animator anim : getAnimators(holder.itemView)) { anim.setDuration(mDuration).start(); anim.setInterpolator(mInterpolator); } mLastPosition = adapterPosition; } else { ViewHelper.clear(holder.itemView); } }
public void animateRevealShow() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth()/2,0, fab.getWidth() / 2, cvAdd.getHeight()); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } @Override public void onAnimationStart(Animator animation) { cvAdd.setVisibility(View.VISIBLE); super.onAnimationStart(animation); } }); mAnimator.start(); }
public void initialize(Config config) { int miniSize = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DEFAULT_INDICATOR_WIDTH, getResources().getDisplayMetrics()) + 0.5f); mIndicatorWidth = (config.width < 0) ? miniSize : config.width; mIndicatorHeight = (config.height < 0) ? miniSize : config.height; mIndicatorMargin = (config.margin < 0) ? miniSize : config.margin; mAnimatorOut = createAnimatorOut(config); mImmediateAnimatorOut = createAnimatorOut(config); mImmediateAnimatorOut.setDuration(0); mAnimatorIn = createAnimatorIn(config); mImmediateAnimatorIn = createAnimatorIn(config); mImmediateAnimatorIn.setDuration(0); mIndicatorBackgroundResId = (config.backgroundResId == 0) ? R.drawable.white_radius : config.backgroundResId; mIndicatorUnselectedBackgroundResId = (config.unselectedBackgroundId == 0) ? config.backgroundResId : config.unselectedBackgroundId; setOrientation(config.orientation == VERTICAL ? VERTICAL : HORIZONTAL); setGravity(config.gravity >= 0 ? config.gravity : Gravity.CENTER); }
public void animateRevealClose() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd,cvAdd.getWidth()/2,0, cvAdd.getHeight(), fab.getWidth() / 2); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { cvAdd.setVisibility(View.INVISIBLE); super.onAnimationEnd(animation); fab.setImageResource(R.drawable.plus); AActivityTwo.super.onBackPressed(); } @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); } }); mAnimator.start(); } @Override
private void checkIndicatorConfig(Context context) { mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth; mIndicatorHeight = (mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight; mIndicatorMargin = (mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin; mAnimatorOut = createAnimatorOut(); mImmediateAnimatorOut = createAnimatorOut(); mImmediateAnimatorOut.setDuration(0); mAnimatorIn = createAnimatorIn(context); mImmediateAnimatorIn = createAnimatorIn(context); mImmediateAnimatorIn.setDuration(0); }
void revealPostingProgress() { Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting, (int) fabPosting.getPivotX(), (int) fabPosting.getPivotY(), 0f, fabPosting.getWidth() / 2) .setDuration(600L); reveal.setInterpolator(AnimUtils.getFastOutLinearInInterpolator(this)); reveal.start(); AnimatedVectorDrawable uploading = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading); if (uploading != null) { fabPosting.setImageDrawable(uploading); uploading.start(); } }