Java 类android.animation.ObjectAnimator 实例源码

项目:LaunchEnr    文件:BubbleTextView.java   
public void applyBadgeState(ItemInfo itemInfo, boolean animate) {
    if (mIcon instanceof FastBitmapDrawable) {
        boolean wasBadged = mBadgeInfo != null;
        mBadgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
        boolean isBadged = mBadgeInfo != null;
        float newBadgeScale = isBadged ? 1f : 0;
        mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
        if (wasBadged || isBadged) {
            mBadgePalette = ((FastBitmapDrawable) mIcon).getIconPalette();
            // Animate when a badge is first added or when it is removed.
            if (animate && (wasBadged ^ isBadged) && isShown()) {
                ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start();
            } else {
                mBadgeScale = newBadgeScale;
                invalidate();
            }
        }
    }
}
项目:ArcLayout-master    文件:DemoLikeTumblrActivity.java   
private Animator createShowItemAnimator(View item) {
  float dx = centerItem.getX() - item.getX();
  float dy = centerItem.getY() - item.getY();

  item.setScaleX(0f);
  item.setScaleY(0f);
  item.setTranslationX(dx);
  item.setTranslationY(dy);

  Animator anim = ObjectAnimator.ofPropertyValuesHolder(
      item,
      AnimatorUtils.scaleX(0f, 1f),
      AnimatorUtils.scaleY(0f, 1f),
      AnimatorUtils.translationX(dx, 0f),
      AnimatorUtils.translationY(dy, 0f)
  );

  anim.setInterpolator(new DecelerateInterpolator());
  anim.setDuration(50);
  return anim;
}
项目:LiveGiftLayout    文件:CustormAnim.java   
@NonNull
    private AnimatorSet testAnim(GiftFrameLayout giftFrameLayout) {
        PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", 0, -50);
        PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.5f);
        ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator.setStartDelay(0);
        animator.setDuration(1500);

        translationY = PropertyValuesHolder.ofFloat("translationY", -50, -100);
        alpha = PropertyValuesHolder.ofFloat("alpha", 0.5f, 0f);
        ObjectAnimator animator1 = ObjectAnimator.ofPropertyValuesHolder(giftFrameLayout, translationY, alpha);
        animator1.setStartDelay(0);
        animator1.setDuration(1500);

        // 复原
//        ObjectAnimator fadeAnimator2 = GiftAnimationUtil.createFadeAnimator(giftFrameLayout, 0, 0, 0, 0);

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(animator1).after(animator);
//        animatorSet.play(fadeAnimator2).after(animator1);
        animatorSet.start();
        return animatorSet;
    }
项目:ViewPagerHelper    文件:ZoomIndicator.java   
/**
 * 用于小圆点的放大缩小
 * @param view
 * @param type
 */
private void targetViewAnim(final View view, final int type){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator scaleX = null;
    ObjectAnimator scaleY = null;
    ObjectAnimator alpha = null;
    if (type == ANIM_OUT){
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",SCALE_MIN,mScale_max);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",SCALE_MIN,mScale_max);
        alpha = ObjectAnimator.ofFloat(view,"alpha",mAlpha_min,ALPHA_MAX);
        animatorSet.setDuration(ANIM_OUT_TIME);
    }else{
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",mScale_max,SCALE_MIN);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",mScale_max,SCALE_MIN);
        alpha = ObjectAnimator.ofFloat(view,"alpha",ALPHA_MAX,mAlpha_min);
        animatorSet.setDuration(ANIM_IN_TIME);
    }
    animatorSet.play(scaleX).with(scaleY).with(alpha);

    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.start();

}
项目:RLibrary    文件:EmptyView.java   
private void initAnimator() {
    if (mObjectAnimator == null) {
        mObjectAnimator = ObjectAnimator.ofInt(3, 6);
        mObjectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int value = (int) animation.getAnimatedValue();
                if (value != last) {
                    last = value;
                    factor = last / 10f;
                    L.e("call: onAnimationUpdate([animation])-> " + factor);
                    postInvalidate();
                }
            }
        });
        mObjectAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mObjectAnimator.setRepeatMode(ValueAnimator.REVERSE);
        mObjectAnimator.setDuration(300);
        mObjectAnimator.start();
    }
}
项目:Flubber    文件:FlipY.java   
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {

    final float startRotation = view.getRotationY();
    final float endRotation = startRotation + 180f;

    final PropertyValuesHolder rotationPVH =
            PropertyValuesHolder.ofFloat(View.ROTATION_Y, startRotation, endRotation);

    final ObjectAnimator animation =
            ObjectAnimator.ofPropertyValuesHolder(view, rotationPVH);

    return animation;
}
项目:GitHub    文件:AuthRefreshRecyclerFragment.java   
@Override public void showContent() {

    if (adapter.getItemCount() == 0) {
      if (isRestoringViewState()) {
        emptyView.setVisibility(View.VISIBLE);
      } else {
        ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
        anim.setStartDelay(250);
        anim.addListener(new AnimatorListenerAdapter() {

          @Override public void onAnimationStart(Animator animation) {
            emptyView.setVisibility(View.VISIBLE);
          }
        });
        anim.start();
      }
    } else {
      emptyView.setVisibility(View.GONE);
    }

    super.showContent();
  }
项目:MaterialDesignDemo    文件:ObjectAnimationActivity2.java   
public void startSecondAnimation(View view) {
    ObjectAnimator rotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 0f, 25f);
    ObjectAnimator alphaAnimation = ObjectAnimator.ofFloat(mView1, "alpha", 0.5f, 1f);
    ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(mView1, "scaleX", 0.8f, 1f);
    ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(mView1, "scaleY", 0.8f, 1f);
    ObjectAnimator translationYAnimation = ObjectAnimator.ofFloat(mView1, "translationY", -0.1f * mView1.getHeight(), 0f);
    ObjectAnimator rerotationXAnimation = ObjectAnimator.ofFloat(mView1, "rotationX", 25f, 0f);
    rerotationXAnimation.setStartDelay(200);
    ObjectAnimator translationYAnimation2 = ObjectAnimator.ofFloat(mView2, "translationY", 0, mView2.getHeight());
    translationYAnimation2.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mView2.setVisibility(View.INVISIBLE);
        }
    });

    AnimatorSet as = new AnimatorSet();
    as.playTogether(rotationXAnimation, alphaAnimation, scaleXAnimation, scaleYAnimation,
            translationYAnimation,
            rerotationXAnimation, translationYAnimation2);
    as.setDuration(200);
    as.start();
}
项目:empty-state-recyclerview    文件:AbstractContentLoadingState.java   
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    final int width = rv.getMeasuredWidth();
    final int height = rv.getMeasuredHeight();

    // Draw all of our content items
    renderContent(numberOfContentItems, width, height, canvas, contentPaint);

    // Setup and start animation, if possible
    if (animateContentItems) {
        if (anim == null) {
            this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
                    Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
            onInterceptAnimatorCreation(anim);
            this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    rv.invalidate();
                }
            });
            this.anim.start();
        }
    }
}
项目:gmlrva    文件:ViewHolderAnimationHelper.java   
/**
 * Procedure meant to execute a change animation for the desired {@link RecyclerView.ViewHolder}.
 * @param holder the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
 * @param itemView the {@link RecyclerView.ViewHolder}'s root view.
 * @param listener the {@link GenericItemAnimator} instance orchestrating the animations.
 * @return the resulting {@link AnimatorSet} for the {@link RecyclerView} item's {@link RecyclerView.ViewHolder}.
 */
public static AnimatorSet runTestChangeAnimation(@NonNull final RecyclerView.ViewHolder holder,
                                          @NonNull final View itemView,
                                          @NonNull final GenericItemAnimator listener) {
    final ObjectAnimator oldTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, 0, 90);
    final ObjectAnimator newTextRotate = ObjectAnimator.ofFloat(itemView, View.ROTATION_X, -90, 0);
    final AnimatorSet textAnim = new AnimatorSet();

    textAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(@NonNull final Animator animation) {
            listener.onAnimationFinished(holder, CHANGE_ANIMATION_FINISHED);
        }
    });

    textAnim.playSequentially(oldTextRotate, newTextRotate);
    return textAnim;
}
项目:SunmiUI    文件:DownUpActivity.java   
/**
 * 隐藏下面的菜单
 */
private void hide() {
    rel.startAnimation(mHiddenAction);
    rel.setVisibility(View.INVISIBLE);

    mFloatingActionsMenu.startAnimation(mHiddenAction1);
    mFloatingActionsMenu.setVisibility(View.INVISIBLE);

    animatorHeadHide = ObjectAnimator.ofFloat(vvv, "translationY", 0, -headHight);
    animatorHeadHide.setDuration(666);
    animatorHeadHide.start();


    animatorHeadHide.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.e("lllxxx",animation.getAnimatedValue()+"===");
            linearParams.height = headHight+(int)((float)animation.getAnimatedValue());
            head.setLayoutParams(linearParams);
        }
    });

}
项目:QMUI_Android    文件:QMUIAnimationListView.java   
protected ObjectAnimator alphaObjectAnimator(View view, final boolean fadeIn, long duration, boolean postBack) {
    final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", fadeIn ? new float[]{
            0f, 1f} : new float[]{1f, 0f});

    anim.setDuration(duration);

    if (postBack) {
        final WeakReference<View> wr = new WeakReference<>(view);
        anim.addListener(new ManipulateAnimatorListener() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (wr.get() != null) {
                    wr.get().setAlpha(fadeIn ? 0 : 1);
                }
            }
        });
    }

    return anim;
}
项目:mvvm-template    文件:AnimHelper.java   
@UiThread public static void startBeatsAnimation(@NonNull View view) {
    view.clearAnimation();
    if (view.getAnimation() != null) {
        view.getAnimation().cancel();
    }
    List<ObjectAnimator> animators = getBeats(view);
    for (ObjectAnimator anim : animators) {
        anim.setDuration(300).start();
        anim.setInterpolator(interpolator);
    }
}
项目:KokoWalk    文件:CharaView.java   
public void moveAbsolute(View v, float addX, float addY, float rad, int mSec) {
    if(addX > mCurrentX)mDirection = 1;
    else mDirection = 0;

    PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("translationX", mCurrentX, addX);
    PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("translationY", mCurrentY, addY);
    PropertyValuesHolder holderRotaion = PropertyValuesHolder.ofFloat("rotation", mCurrentRad, mCurrentRad + rad);

    ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(v, holderX, holderY, holderRotaion);
    objectAnimator.setDuration(mSec);

    mCurrentX = addX;
    mCurrentY = addY;
    mCurrentRad = (mCurrentRad + rad) % 360;

    objectAnimator.start();
}
项目:DragPointView    文件:SampleActivity.java   
private void initAnim() {

        animationDrawable = new AnimationDrawable();
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode1), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode2), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode3), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode4), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode5), 100);
        animationDrawable.setOneShot(true);
        animationDrawable.setExitFadeDuration(300);
        animationDrawable.setEnterFadeDuration(100);

        ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(null, "scaleX", 1.f, 0.f);
        ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(null, "scaleY", 1.f, 0.f);
        animatorSet = new AnimatorSet();
        animatorSet.setDuration(300l);
        animatorSet.playTogether(objectAnimator1, objectAnimator2);

        objectAnimator = ObjectAnimator.ofFloat(null, "alpha", 1.f, 0.f);
        objectAnimator.setDuration(2000l);
    }
项目:PlusGram    文件:PhotoPaintView.java   
private void closeStickersView() {
    if (stickersView == null || stickersView.getVisibility() != VISIBLE) {
        return;
    }
    pickingSticker = false;

    Animator a = ObjectAnimator.ofFloat(stickersView, "alpha", 1.0f, 0.0f);
    a.setDuration(200);
    a.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animator) {
            stickersView.setVisibility(GONE);
        }
    });
    a.start();

    undoItem.setVisibility(VISIBLE);
    actionBar.setTitle(LocaleController.getString("PaintDraw", R.string.PaintDraw));
}
项目:ExpandButton    文件:ExpandButtonLayout.java   
public void close() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);
        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", mLinearLayoutWidth, 0);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
项目:boohee_v5.6    文件:PullToZoomScrollView.java   
private void reset() {
    if (this.mAnimator == null || !this.mAnimator.isRunning()) {
        this.mAnimator = ObjectAnimator.ofInt(this, "t", new int[]{((int) (-this.distance)) /
                4, 0});
        this.mAnimator.setDuration(150);
        this.mAnimator.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                PullToZoomScrollView.this.isPreparePull = false;
                if (PullToZoomScrollView.this.distance / aj.hA > ((float)
                        PullToZoomScrollView.this.DEFAULT_PULL_HEIGHT)) {
                    if (PullToZoomScrollView.this.onPullToZoomListener != null) {
                        PullToZoomScrollView.this.onPullToZoomListener.onPull();
                    }
                } else if (PullToZoomScrollView.this.onPullToZoomListener != null) {
                    PullToZoomScrollView.this.onPullToZoomListener.onCancelPull();
                }
            }
        });
        this.mAnimator.start();
    }
}
项目:72GGames_Demo    文件:BottomMenu.java   
public void selectMenu(){
    tvMenu.setVisibility(INVISIBLE);
    ivIcon.setImageResource(selectIconId);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(null,"xxx",0,1).setDuration(300);
    objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float progress = (float) animation.getAnimatedValue();
            setPivotX(getWidth()/2);
            setPivotY(0);
            setScaleX(1+progress*THRESHOLD);
            setScaleY(1+progress*THRESHOLD);
        }
    });

    objectAnimator.start();

}
项目:airgram    文件:DrawerLayoutContainer.java   
public void closeDrawer(boolean fast) {
    cancelCurrentAnimation();
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(this, "drawerPosition", 0)
    );
    animatorSet.setInterpolator(new DecelerateInterpolator());
    if (fast) {
        animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * drawerPosition), 50));
    } else {
        animatorSet.setDuration(300);
    }
    animatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animator) {
            onDrawerAnimationEnd(false);
        }
    });
    animatorSet.start();
}
项目:boohee_v5.6    文件:VideoPlayActivity.java   
private void updateProgress() {
    if (this.progressAnimator != null && this.progressAnimator.isRunning()) {
        this.progressAnimator.end();
    }
    double progress = (double) (((this.mentionIndex * 1000) + ((this.playCountNum * 1000) /
            this.currentMention.number)) / this.totalMetionCount);
    this.progressAnimator = ObjectAnimator.ofInt(this.progressBar, "progress", new int[]{
            (int) progress});
    if (this.currentMention.is_times) {
        this.progressAnimator.setDuration(((long) this.currentMention.rate) * 1000);
    } else {
        this.progressAnimator.setDuration(1000);
    }
    this.progressAnimator.setInterpolator(new LinearInterpolator());
    this.progressAnimator.start();
}
项目:Material-Motion    文件:DotsFragment.java   
private AnimatorSet morphParent(int duration){
    GradientDrawable drawable=GradientDrawable.class.cast(parent.getBackground());
    int endValue=isFolded?getResources().getDimensionPixelOffset(R.dimen.morph_radius):0;
    ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(drawable, "cornerRadius", endValue);
    endValue=isFolded?parent.getHeight()/2:parent.getHeight()*2;
    ValueAnimator heightAnimation = ValueAnimator.ofInt(parent.getHeight(),endValue);
    heightAnimation.addUpdateListener(valueAnimator-> {
        int val = (Integer) valueAnimator.getAnimatedValue();
        ViewGroup.LayoutParams layoutParams = parent.getLayoutParams();
        layoutParams.height = val;
        parent.setLayoutParams(layoutParams);
    });
    cornerAnimation.setDuration(duration);
    heightAnimation.setDuration(duration);
    AnimatorSet set=new AnimatorSet();
    set.playTogether(cornerAnimation,heightAnimation);
    return set;
}
项目:KUtils    文件:RotateInDownRightAnimator.java   
@Override
public void prepare(View target) {
    float x = target.getWidth() - target.getPaddingRight();
    float y = target.getHeight() - target.getPaddingBottom();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "rotation", 90, 0),
            ObjectAnimator.ofFloat(target, "alpha", 0, 1),
            ObjectAnimator.ofFloat(target, "pivotX", x, x),
            ObjectAnimator.ofFloat(target, "pivotY", y, y)
    );
}
项目:Rey-MusicPlayer    文件:FastScroller.java   
private void showBubble() {
    bubble.setVisibility(VISIBLE);
    showViews();
    if (currentAnimator != null)
        currentAnimator.cancel();
    currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
    currentAnimator.start();
}
项目:PDialogs-Android    文件:Selector.java   
public void select(@Nullable String selectTitle) {
    ObjectAnimator colorAnim = ObjectAnimator.ofInt(binding.textViewDialogSelector
            , "textColor", binding.textViewDialogSelector.getCurrentTextColor(), ContextCompat.getColor(context, R.color.accentColor));
    colorAnim.setEvaluator(new ArgbEvaluator());
    colorAnim.start();
    binding.iconImgv.setImageResource(selectedIcon);

    binding.textViewDialogSelector.setText(selectTitle);
    binding.selectorImgv.setImageResource(R.drawable.ic_previous_selected_p_dialog);
    binding.selectorRly.setBackgroundResource(R.drawable.border_radius_20_selected_p_dialog);

    isSelected = true;
}
项目:KUtils-master    文件:HingeAnimator.java   
@Override
public void prepare(View target) {
    float x = target.getPaddingLeft();
    float y = target.getPaddingTop();
    getAnimatorAgent().playTogether(
            Glider.glide(Skill.SineEaseInOut, 1300, ObjectAnimator.ofFloat(target, "rotation", 0, 80, 60, 80, 60, 60)),
            ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700),
            ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0),
            ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x),
            ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y)
    );

    setDuration(1300);
}
项目:DizzyPassword    文件:MainActivity.java   
private void startAnim() {
    animator = ObjectAnimator.ofFloat(refresh, "rotation", 0f, 360.0f);
    animator.setDuration(500);
    animator.setInterpolator(new LinearInterpolator());//不停顿
    animator.setRepeatCount(-1);//设置动画重复次数
    animator.setRepeatMode(ValueAnimator.RESTART);//动画重复模式
    startAnimation(animator);
}
项目:TimePicker    文件:RadialSelectorView.java   
public ObjectAnimator getReappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }

    Keyframe kf0, kf1, kf2, kf3;
    float midwayPoint = 0.2f;
    int duration = 500;

    // The time points are half of what they would normally be, because this animation is
    // staggered against the disappear so they happen seamlessly. The reappear starts
    // halfway into the disappear.
    float delayMultiplier = 0.25f;
    float transitionDurationMultiplier = 1f;
    float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    int totalDuration = (int) (duration * totalDurationMultiplier);
    float delayPoint = (delayMultiplier * duration) / totalDuration;
    midwayPoint = 1 - (midwayPoint * (1 - delayPoint));

    kf0 = Keyframe.ofFloat(0f, mTransitionEndRadiusMultiplier);
    kf1 = Keyframe.ofFloat(delayPoint, mTransitionEndRadiusMultiplier);
    kf2 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf3 = Keyframe.ofFloat(1f, 1);
    PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe(
            "animationRadiusMultiplier", kf0, kf1, kf2, kf3);

    kf0 = Keyframe.ofFloat(0f, 0f);
    kf1 = Keyframe.ofFloat(delayPoint, 0f);
    kf2 = Keyframe.ofFloat(1f, 1f);
    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);

    ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
            this, radiusReappear, fadeIn).setDuration(totalDuration);
    reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    return reappearAnimator;
}
项目:KUtils-master    文件:TakingOffAnimator.java   
@Override
protected void prepare(View target) {
    getAnimatorAgent().playTogether(
            Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "scaleX", 1f, 1.5f)),
            Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "scaleY", 1f, 1.5f)),
            Glider.glide(Skill.QuintEaseOut, getDuration(), ObjectAnimator.ofFloat(target, "alpha", 1, 0))
    );
}
项目:buildAPKsSamples    文件:RoundView.java   
public ObjectAnimator getScalingAnimator() {
    PropertyValuesHolder imgViewScaleY = PropertyValuesHolder.ofFloat(View
            .SCALE_Y, SCALE_FACTOR);
    PropertyValuesHolder imgViewScaleX = PropertyValuesHolder.ofFloat(View
            .SCALE_X, SCALE_FACTOR);

    ObjectAnimator imgViewScaleAnimator = ObjectAnimator
            .ofPropertyValuesHolder(this, imgViewScaleX, imgViewScaleY);
    imgViewScaleAnimator.setRepeatCount(1);
    imgViewScaleAnimator.setRepeatMode(ValueAnimator.REVERSE);
    imgViewScaleAnimator.setDuration(ANIMATION_DURATION);

    return imgViewScaleAnimator;
}
项目:GitHub    文件:ChartAnimator.java   
/**
 * Animates the rendering of the chart on the x-axis with the specified
 * animation time. If animate(...) is called, no further calling of
 * invalidate() is necessary to refresh the chart.
 *
 * @param durationMillis
 * @param easing
 */
public void animateX(int durationMillis, EasingFunction easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f);
    animatorX.setInterpolator(easing);
    animatorX.setDuration(durationMillis);
    animatorX.addUpdateListener(mListener);
    animatorX.start();
}
项目:LuaViewPlayground    文件:RollOutAnimatorDecoration.java   
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 1, 0),
            ObjectAnimator.ofFloat(target, "translationX", 0, target.getWidth()),
            ObjectAnimator.ofFloat(target, "rotation", 0, 120)
    );
}
项目:SimpleUILauncher    文件:QsbBlockerView.java   
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
    int finalAlpha = getAlphaForState(toState);
    if (targetAnim == null) {
        mBgPaint.setAlpha(finalAlpha);
        invalidate();
    } else {
        ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
        anim.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                invalidate();
            }
        });
        targetAnim.play(anim);
    }
}
项目:LuaViewPlayground    文件:ZoomInLeftAnimatorDecoration.java   
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", 0.1f, 0.475f, 1),
            ObjectAnimator.ofFloat(target, "scaleY", 0.1f, 0.475f, 1),
            ObjectAnimator.ofFloat(target, "translationX", -target.getRight(), 48, 0),
            ObjectAnimator.ofFloat(target, "alpha", 0, 1, 1)
    );
}
项目:Flubber    文件:SlideRight.java   
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {

    final float startY = DimensionUtils.dp2px(-800);
    final float endY = 0f;

    final PropertyValuesHolder translationPVH =
            PropertyValuesHolder.ofFloat(View.TRANSLATION_X, startY, endY);

    final ObjectAnimator animation =
            ObjectAnimator.ofPropertyValuesHolder(view, translationPVH);

    return animation;
}
项目:KUtils-master    文件:ZoomInLeftAnimator.java   
@Override
public void prepare(View target) {
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", 0.1f, 0.475f, 1),
            ObjectAnimator.ofFloat(target, "scaleY", 0.1f, 0.475f, 1),
            ObjectAnimator.ofFloat(target, "translationX", -target.getRight(), 48, 0),
            ObjectAnimator.ofFloat(target, "alpha", 0, 1, 1)
    );
}
项目:ReadMark    文件:MultiFloatingActionButton.java   
private void scaleToShow(){
    for(int i = 2; i<getChildCount(); i++){
        View view = getChildAt(i);
        view.setVisibility(VISIBLE);
        view.setAlpha(0);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f);
        ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
        AnimatorSet set = new AnimatorSet();
        set.playTogether(scaleX, scaleY, alpha);
        set.setDuration(mAnimationDuration);
        set.start();
    }
}
项目:PlusGram    文件:ObjectAnimatorProxy.java   
public static Object ofInt(Object target, String propertyName, int... values) {
    if (View10.NEED_PROXY) {
        return ObjectAnimator10.ofInt(target, propertyName, values);
    } else {
        return ObjectAnimator.ofInt(target, propertyName, values);
    }
}
项目:VirtualHook    文件:MaterialRippleLayout.java   
private void startHover() {
    if (eventCancelled) return;

    if (hoverAnimator != null) {
        hoverAnimator.cancel();
    }
    final float radius = (float) (Math.sqrt(Math.pow(getWidth(), 2) + Math.pow(getHeight(), 2)) * 1.2f);
    hoverAnimator = ObjectAnimator.ofFloat(this, radiusProperty, rippleDiameter, radius)
        .setDuration(HOVER_DURATION);
    hoverAnimator.setInterpolator(new LinearInterpolator());
    hoverAnimator.start();
}
项目:Sega    文件:SearchArrowDrawable.java   
void animate(float state, int duration) {
    ObjectAnimator anim;
    if (state == STATE_ARROW) {
        anim = ObjectAnimator.ofFloat(this, PROGRESS, state, STATE_HAMBURGER);
    } else {
        anim = ObjectAnimator.ofFloat(this, PROGRESS, state, STATE_ARROW);
    }
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(duration);
    anim.start();
}