Java 类com.nineoldandroids.animation.AnimatorSet 实例源码

项目:MenuSet    文件:MenuAdapter.java   
/**
 * Filling arrays of animations to build Set of Closing / Opening animations
 */
private void fillOpenClosingAnimations(boolean isCloseAnimation, List<Animator> textAnimations, List<Animator> imageAnimations, int wrapperPosition) {
    AnimatorSet textAnimatorSet = new AnimatorSet();
    Animator textAppearance = isCloseAnimation ?
            AnimatorUtils.alfaDisappear(mTextWrapper.getChildAt(wrapperPosition))
            : AnimatorUtils.alfaAppear(mTextWrapper.getChildAt(wrapperPosition));

    Animator textTranslation = isCloseAnimation ?
            AnimatorUtils.translationRight(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation))
            : AnimatorUtils.translationLeft(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation));

    textAnimatorSet.playTogether(textAppearance, textTranslation);
    textAnimations.add(textAnimatorSet);

    Animator imageRotation = isCloseAnimation ?
            wrapperPosition == 0 ? AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationCloseVertical(mMenuWrapper.getChildAt(wrapperPosition))
            : wrapperPosition == 0 ? AnimatorUtils.rotationOpenFromRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationOpenVertical(mMenuWrapper.getChildAt(wrapperPosition));
    imageAnimations.add(imageRotation);
}
项目:ListViewAnimations    文件:SwipeUndoTouchListener.java   
/**
 * Performs the undo animation and restores the original state for given {@link android.view.View}.
 *
 * @param view the parent {@code View} which contains both primary and undo {@code View}s.
 */
public void undo(@NonNull final View view) {
    int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view);
    mUndoPositions.remove(position);

    View primaryView = mCallback.getPrimaryView(view);
    View undoView = mCallback.getUndoView(view);

    primaryView.setVisibility(View.VISIBLE);

    ObjectAnimator undoAlphaAnimator = ObjectAnimator.ofFloat(undoView, ALPHA, 1f, 0f);
    ObjectAnimator primaryAlphaAnimator = ObjectAnimator.ofFloat(primaryView, ALPHA, 0f, 1f);
    ObjectAnimator primaryXAnimator = ObjectAnimator.ofFloat(primaryView, TRANSLATION_X, primaryView.getWidth(), 0f);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator);
    animatorSet.addListener(new UndoAnimatorListener(undoView));
    animatorSet.start();

    mCallback.onUndo(view, position);
}
项目:ListViewAnimations    文件:SwipeTouchListener.java   
/**
 * Flings given {@link android.view.View} out of sight.
 *
 * @param view         the parent {@link android.view.View}.
 * @param position     the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}.
 * @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left.
 */
private void flingView(@NonNull final View view, final int position, final boolean flingToRight) {
    if (mViewWidth < 2) {
        mViewWidth = mListViewWrapper.getListView().getWidth();
    }

    View swipeView = getSwipeView(view);
    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new FlingAnimatorListener(view, position));
    animatorSet.start();
}
项目:ListViewAnimations    文件:ViewAnimator.java   
/**
 * Animates given View.
 *
 * @param view the View that should be animated.
 */
private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = SystemClock.uptimeMillis();
    }

    ViewHelper.setAlpha(view, 0);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(animators);
    set.setStartDelay(calculateAnimationDelay(position));
    set.setDuration(mAnimationDurationMillis);
    set.start();

    mAnimators.put(view.hashCode(), set);
}
项目:mvpChat    文件:EditTextActivity.java   
@Override
public void startActivityAnimation() {
    int actionBarHeight = getActionBarSize();
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenHeight = dm.heightPixels;
    int contentEditHeight = screenHeight - actionBarHeight * 2;
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(Const.DURATION_ACTIVITY);
    animation.playTogether(
            ObjectAnimator.ofFloat(mToolbar, "translationY", -actionBarHeight, 0),
            ObjectAnimator.ofFloat(mLayoutTitle, "translationY", -actionBarHeight * 2, 0),
            ObjectAnimator.ofFloat(mContentEdit, "translationY", contentEditHeight, 0),
            ObjectAnimator.ofFloat(mFabMenuLayout, "translationY", contentEditHeight, 0)
    );
    animation.start();
}
项目:Context-Menu-android    文件:MenuAdapter.java   
/**
 * Filling arrays of animations to build Set of Closing / Opening animations
 */
private void fillOpenClosingAnimations(boolean isCloseAnimation, List<Animator> textAnimations, List<Animator> imageAnimations, int wrapperPosition) {
    AnimatorSet textAnimatorSet = new AnimatorSet();
    Animator textAppearance = isCloseAnimation ?
            AnimatorUtils.alfaDisappear(mTextWrapper.getChildAt(wrapperPosition))
            : AnimatorUtils.alfaAppear(mTextWrapper.getChildAt(wrapperPosition));

    Animator textTranslation = isCloseAnimation ?
            AnimatorUtils.translationRight(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation))
            : AnimatorUtils.translationLeft(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation));

    textAnimatorSet.playTogether(textAppearance, textTranslation);
    textAnimations.add(textAnimatorSet);

    Animator imageRotation = isCloseAnimation ?
            wrapperPosition == 0 ? AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationCloseVertical(mMenuWrapper.getChildAt(wrapperPosition))
            : wrapperPosition == 0 ? AnimatorUtils.rotationOpenFromRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationOpenVertical(mMenuWrapper.getChildAt(wrapperPosition));
    imageAnimations.add(imageRotation);
}
项目:HPlayer    文件:AnimationAdapter.java   
private void animateView(final ViewGroup parent, final View view) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = System.currentTimeMillis();
    }

    ViewHelper.setAlpha(view, 0);

    Animator[] childAnimators;
    if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
        childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
    } else {
        childAnimators = new Animator[0];
    }
    Animator[] animators = getAnimators(parent, view);
    Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
    set.setStartDelay(calculateAnimationDelay());
    set.setDuration(getAnimationDurationMillis());
    set.start();

    mAnimators.put(view.hashCode(), set);
}
项目:android-open-project-demo-master    文件:AnimationAdapter.java   
private void animateView(final ViewGroup parent, final View view) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = System.currentTimeMillis();
    }

    ViewHelper.setAlpha(view, 0);

    Animator[] childAnimators;
    if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
        childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
    } else {
        childAnimators = new Animator[0];
    }
    Animator[] animators = getAnimators(parent, view);
    Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
    set.setStartDelay(calculateAnimationDelay());
    set.setDuration(getAnimationDurationMillis());
    set.start();

    mAnimators.put(view.hashCode(), set);
}
项目:MyScse-Client    文件:ResideMenu.java   
/**
 * A helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target, float targetScaleX, float targetScaleY) {

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    if (mUse3D) {
        int angle = scaleDirection == DIRECTION_LEFT ? -ROTATE_Y_ANGLE : ROTATE_Y_ANGLE;
        scaleDown.playTogether(ObjectAnimator.ofFloat(target, "rotationY", angle));
    }

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
项目:MyScse-Client    文件:ResideMenu.java   
/**
 * A helper method to build scale up animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleUpAnimation(View target, float targetScaleX, float targetScaleY) {

    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    if (mUse3D) {
        scaleUp.playTogether(ObjectAnimator.ofFloat(target, "rotationY", 0));
    }

    scaleUp.setDuration(250);
    return scaleUp;
}
项目:AndroidStudyDemo    文件:NineOldAndroidsActivity.java   
/**
 * 打开菜单的动画
 * @param view 执行动画的view
 * @param index view在动画序列中的顺序
 * @param total 动画序列的个数
 * @param radius 动画半径
 */
private void doAnimateOpen(View view, int index, int total, int radius) {
    if (view.getVisibility() != View.VISIBLE) {
        view.setVisibility(View.VISIBLE);
    }
    double degree = Math.PI * index / ((total - 1) * 2);
    int translationX = (int) (radius * Math.cos(degree));
    int translationY = (int) (radius * Math.sin(degree));
    Logger.d(String.format("degree = %f, translationX = %d, translationY = %d", degree, translationX, translationY));
    AnimatorSet set = new AnimatorSet();
    // 包含平移、缩放和透明度动画
    set.playTogether(
            ObjectAnimator.ofFloat(view, "translationX", 0, translationX),
            ObjectAnimator.ofFloat(view, "translationY", 0, translationY),
            ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f),
            ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f),
            ObjectAnimator.ofFloat(view, "alpha", 0f, 1f)
    );
    // 动画周期为600ms
    set.setDuration(C.Int.MENU_DURATION * 2).start();
}
项目:AyoSunny    文件:BlurLayout.java   
private void startBlurImageAppearAnimator(){
    if(!enableBlurBackground || mBlurImage == null)    return;

    AnimatorSet set = new AnimatorSet();
     if(enableBackgroundZoom){
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 0.8f, 1f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleX", 1f, mZoomRatio),
                ObjectAnimator.ofFloat(mBlurImage, "scaleY", 1f, mZoomRatio)
        );
    }
    else{
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 0f, 1f)
        );
    }
    set.addListener(mGlobalListener);
    set.addListener(mGlobalAppearingAnimators);
    set.setDuration(mBlurDuration);
    set.start();
}
项目:AyoSunny    文件:BlurLayout.java   
private void startBlurImageDisappearAnimator(){
    if(!enableBlurBackground || mBlurImage == null)    return;

    AnimatorSet set = new AnimatorSet();
    if(enableBackgroundZoom)
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0.8f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleX", mZoomRatio, 1f),
                ObjectAnimator.ofFloat(mBlurImage, "scaleY", mZoomRatio, 1f)
        );
    else
        set.playTogether(
                ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0f)
        );

    set.addListener(mGlobalListener);
    set.addListener(mGlobalDisappearAnimators);
    set.setDuration(mBlurDuration);
    set.start();
}
项目:QQ    文件:ResideMenu.java   
/**
 * A helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target, float targetScaleX, float targetScaleY) {

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    if (mUse3D) {
        int angle = scaleDirection == DIRECTION_LEFT ? -ROTATE_Y_ANGLE : ROTATE_Y_ANGLE;
        scaleDown.playTogether(ObjectAnimator.ofFloat(target, "rotationY", angle));
    }

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
项目:QQ    文件:ResideMenu.java   
/**
 * A helper method to build scale up animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleUpAnimation(View target, float targetScaleX, float targetScaleY) {

    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    if (mUse3D) {
        scaleUp.playTogether(ObjectAnimator.ofFloat(target, "rotationY", 0));
    }

    scaleUp.setDuration(250);
    return scaleUp;
}
项目:nono-android    文件:MyRapidFloatingActionContentLabelList.java   
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{45.0F, 0.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
项目:nono-android    文件:MyRapidFloatingActionContentLabelList.java   
public void onCollapseAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{0.0F, 45.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
项目:RapidFloatingActionButton    文件:RapidFloatingActionContentLabelList.java   
@Override
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = contentView.getChildCount();
    for (int i = 0; i < count; i++) {
        View rootView = contentView.getChildAt(i);
        ImageView iconIv = ABViewUtil.obtainView(rootView, R.id.rfab__content_label_list_icon_iv);
        if (null == iconIv) {
            return;
        }
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(45f, 0);
        animator.setPropertyName("rotation");
        animator.setInterpolator(mOvershootInterpolator);
        animator.setStartDelay((count * i) * 20);
        animatorSet.playTogether(animator);
    }
}
项目:GifAssistant    文件:ResideMenu.java   
/**
 * show the reside menu;
 */
public void openMenu(int direction){
    if (isInDisableDirection(direction))
        throw new IllegalArgumentException("You have set this direction disable, " +
                "but now you want to open menu in this direction.");
    setScaleDirection(direction);

    isOpened = true;
    AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity, 0.5f, 0.5f);
    AnimatorSet scaleDown_shadow = buildScaleDownAnimation(imageViewShadow,
            0.5f + shadowAdjustScaleX, 0.5f + shadowAdjustScaleY);
    AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 1.0f);
    scaleDown_shadow.addListener(animationListener);
    scaleDown_activity.playTogether(scaleDown_shadow);
    scaleDown_activity.playTogether(alpha_menu);
    scaleDown_activity.start();
}
项目:Android-ParallaxHeaderViewPager-master    文件:KenBurnsSupportView.java   
private void swapImage() {
    Log.d(TAG, "swapImage active=" + mActiveImageIndex);
    if(mActiveImageIndex == -1) {
        mActiveImageIndex = 1;
        animate(mImageViews[mActiveImageIndex]);
        return;
    }

    int inactiveIndex = mActiveImageIndex;
    mActiveImageIndex = (1 + mActiveImageIndex) % mImageViews.length;
    Log.d(TAG, "new active=" + mActiveImageIndex);

    final ImageView activeImageView = mImageViews[mActiveImageIndex];
    ViewHelper.setAlpha(activeImageView, 0.0f);
    ImageView inactiveImageView = mImageViews[inactiveIndex];

    animate(activeImageView);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(mFadeInOutMs);
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(inactiveImageView, "alpha", 1.0f, 0.0f),
            ObjectAnimator.ofFloat(activeImageView, "alpha", 0.0f, 1.0f)
    );
    animatorSet.start();
}
项目:Android-PullToNextLayout    文件:SimpleAnimation.java   
public Animator getPullDownAnimIn(View view) {

        ObjectAnimator in = ObjectAnimator.ofFloat(view, "translationY", -view.getMeasuredHeight(), 0);

        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1);

        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
项目:Android-PullToNextLayout    文件:SimpleAnimation.java   
private Animator getPullUpAnimIn(View view) {

        ObjectAnimator in =   ObjectAnimator.ofFloat(view, "translationY", view.getMeasuredHeight(), 0);
//        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "rotationX", 20, 0);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1f);
        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
项目:PhoneMate    文件:SwipeUndoTouchListener.java   
/**
 * Performs the undo animation and restores the original state for given {@link android.view.View}.
 *
 * @param view the parent {@code View} which contains both primary and undo {@code View}s.
 */
public void undo(@NonNull final View view) {
    int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view);
    mUndoPositions.remove(position);

    View primaryView = mCallback.getPrimaryView(view);
    View undoView = mCallback.getUndoView(view);

    primaryView.setVisibility(View.VISIBLE);

    ObjectAnimator undoAlphaAnimator = ObjectAnimator.ofFloat(undoView, ALPHA, 1f, 0f);
    ObjectAnimator primaryAlphaAnimator = ObjectAnimator.ofFloat(primaryView, ALPHA, 0f, 1f);
    ObjectAnimator primaryXAnimator = ObjectAnimator.ofFloat(primaryView, TRANSLATION_X, primaryView.getWidth(), 0f);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator);
    animatorSet.addListener(new UndoAnimatorListener(undoView));
    animatorSet.start();

    mCallback.onUndo(view, position);
}
项目:PhoneMate    文件:SwipeTouchListener.java   
/**
 * Flings given {@link android.view.View} out of sight.
 *
 * @param view         the parent {@link android.view.View}.
 * @param position     the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}.
 * @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left.
 */
private void flingView(@NonNull final View view, final int position, final boolean flingToRight) {
    if (mViewWidth < 2) {
        mViewWidth = mListViewWrapper.getListView().getWidth();
    }

    View swipeView = getSwipeView(view);
    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new FlingAnimatorListener(view, position));
    animatorSet.start();
}
项目:SwipCard    文件:DragCard.java   
/**
 * @param direction 方向
 */
public void dragCard(int direction) {
    if (mIndex > baseGragAdapter.getCount()) {
        return;
    }
    if (!animt_finish)
        return;
    animt_finish = false;
    AnimatorSet animatorSet = baseLayoutManager.animForward(direction, mScale, card_margin, mAlpha, getTopView(), viewCollection);
    animatorSet.start();
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            animt_finish = true;
            mIndex++;
            moveToBack();
        }
    });
    if (cardListener != null)
        cardListener.startSwip(mIndex);
}
项目:SwipCard    文件:TopToBottomLayoutManager.java   
@Override
public AnimatorSet animLast(float m_scale, float card_margin, float m_alpha, View nowView, ArrayList<View> viewCollection) {
    AnimatorSet as = new AnimatorSet();
    ArrayList<Animator> aCollection = new ArrayList<Animator>();
    for (int i = viewCollection.size() - 1; i >= 0; i--) {
        View view = viewCollection.get(i);
        if (view == nowView) {
            continue;
        }
        float s_x = ViewCompat.getScaleX(view);
        float s_y = ViewCompat.getScaleY(view);
        float alpha = ViewCompat.getAlpha(view);
        float y = ViewCompat.getTranslationY(view);
        DragCard.ViewPropertity start = DragCard.ViewPropertity.createProperties(0, y, s_x, s_y, alpha);
        s_x += m_scale;
        s_y += m_scale;
        alpha += m_alpha;
        y += card_margin;
        DragCard.ViewPropertity end = DragCard.ViewPropertity.createProperties(0, y, s_x, s_y, alpha);
        ValueAnimator valueAnimator = AnimUtils.getValueAnimator(start, end, view);
        aCollection.add(valueAnimator);
    }
    as.playTogether(aCollection);
    return as;
}
项目:mc_backup    文件:FirstrunPager.java   
private void animateLoad() {
    ViewHelper.setTranslationY(this, 500);
    ViewHelper.setAlpha(this, 0);

    final Animator translateAnimator = ObjectAnimator.ofFloat(this, "translationY", 0);
    translateAnimator.setDuration(400);

    final Animator alphaAnimator = ObjectAnimator.ofFloat(this, "alpha", 1);
    alphaAnimator.setStartDelay(200);
    alphaAnimator.setDuration(600);

    final AnimatorSet set = new AnimatorSet();
    set.playTogether(alphaAnimator, translateAnimator);
    set.setStartDelay(400);
    TransitionsTracker.track(set);

    set.start();
}
项目:Context-Menu.Android    文件:MenuAdapter.java   
/**
 * Filling arrays of animations to build Set of Closing / Opening animations
 */
private void fillOpenClosingAnimations(boolean isCloseAnimation, List<Animator> textAnimations, List<Animator> imageAnimations, int wrapperPosition) {
    AnimatorSet textAnimatorSet = new AnimatorSet();
    Animator textAppearance = isCloseAnimation ?
            AnimatorUtils.alfaDisappear(mTextWrapper.getChildAt(wrapperPosition))
            : AnimatorUtils.alfaAppear(mTextWrapper.getChildAt(wrapperPosition));

    Animator textTranslation = isCloseAnimation ?
            AnimatorUtils.translationRight(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation))
            : AnimatorUtils.translationLeft(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation));

    textAnimatorSet.playTogether(textAppearance, textTranslation);
    textAnimations.add(textAnimatorSet);

    Animator imageRotation = isCloseAnimation ?
            wrapperPosition == 0 ? AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationCloseVertical(mMenuWrapper.getChildAt(wrapperPosition))
            : wrapperPosition == 0 ? AnimatorUtils.rotationOpenFromRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationOpenVertical(mMenuWrapper.getChildAt(wrapperPosition));
    imageAnimations.add(imageRotation);
}
项目:android-transition    文件:MenuItemTransitionBuilder.java   
@Override
public void setupAnimation(@NonNull MenuItem mMenuItem, @NonNull TransitionControllerManager manager,
                           @IntRange(from = 0) int itemIndex, @IntRange(from = 0) int menuCount) {
    if(mDelayed!=null) {
        final int size = mDelayed.size();
        for (int i = 0; i < size; i++) {
            mDelayed.get(i).evaluate(manager.getTarget(), this);
        }
    }

    ObjectAnimator anim = new ObjectAnimator();
    anim.setValues(getValuesHolders());
    AnimatorSet set = new AnimatorSet();
    set.play(anim);
    set.setStartDelay((long) (itemIndex * mCascade * SCALE_FACTOR));
    set.setDuration((long) (SCALE_FACTOR - itemIndex * mCascade * SCALE_FACTOR));
    manager.addAnimatorSetAsTransition(set).setRange(mStart, mEnd);
}
项目:OpenUCLoading    文件:LoadingView.java   
/**
 * 落地挤压
 */
public void pressView() {
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 1f, 0.7f);
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.7f, 1f);
    scaleYAnimator.setDuration(ANIMATION_DURATION / 2);
    scaleXAnimator.setDuration(ANIMATION_DURATION / 2);
    scaleXAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
    scaleYAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(ANIMATION_DURATION / 2);
    animatorSet.playTogether(scaleXAnimator, scaleYAnimator);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            springView();
        }
    });
    animatorSet.start();
}
项目:OpenUCLoading    文件:LoadingView.java   
/**
 * 反弹
 */
public void springView() {
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0.7f);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleY", 0.7f, 1f);
    scaleYAnimator.setDuration(ANIMATION_DURATION / 4);
    scaleXAnimator.setDuration(ANIMATION_DURATION / 4);
    scaleXAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
    scaleYAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(ANIMATION_DURATION / 4);
    animatorSet.playTogether(scaleXAnimator, scaleYAnimator);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            upThrow();
        }
    });
    animatorSet.start();
}
项目:OpenUCLoading    文件:LoadingView.java   
/**
 * 上抛
 */
public void upThrow() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "translationY", mDistance, 0);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.7f, 1f);
    objectAnimator.setDuration(ANIMATION_DURATION);
    scaleYAnimator.setDuration(ANIMATION_DURATION);
    scaleYAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
    objectAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(ANIMATION_DURATION);
    animatorSet.playTogether(objectAnimator, scaleYAnimator);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            freeFall();
        }
    });
    animatorSet.start();
}
项目:OpenUCLoading    文件:LoadingView.java   
/**
 * 下落
 */
public void freeFall() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "translationY", 0, mDistance);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0.7f);
    objectAnimator.setDuration(ANIMATION_DURATION);
    scaleYAnimator.setDuration(ANIMATION_DURATION);
    scaleYAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
    objectAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(ANIMATION_DURATION);
    animatorSet.playTogether(objectAnimator, scaleYAnimator);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            pressView();
        }
    });
    animatorSet.start();
}
项目:PaoMovie    文件:DragGridView.java   
/**
 * 创建移动动画
 * 
 * @param view
 * @param startX
 * @param endX
 * @param startY
 * @param endY
 * @return
 */
private AnimatorSet createTranslationAnimations(View view, float startX,
        float endX, float startY, float endY) {
    ObjectAnimator animX = ObjectAnimator.ofFloat(view, "translationX",
            startX, endX);
    ObjectAnimator animY = ObjectAnimator.ofFloat(view, "translationY",
            startY, endY);
    AnimatorSet animSetXY = new AnimatorSet();
    animSetXY.playTogether(animX, animY);
    return animSetXY;
}
项目:MenuSet    文件:MenuAdapter.java   
/**
 * Creates Open / Close AnimatorSet
 */
private AnimatorSet setOpenCloseAnimation(boolean isCloseAnimation) {
    List<Animator> textAnimations = new ArrayList<>();
    List<Animator> imageAnimations = new ArrayList<>();

    if (isCloseAnimation) {
        for (int i = getItemCount() - 1; i >= 0; i--) {
            fillOpenClosingAnimations(true, textAnimations, imageAnimations, i);
        }
    } else {
        for (int i = 0; i < getItemCount(); i++) {
            fillOpenClosingAnimations(false, textAnimations, imageAnimations, i);
        }
    }

    AnimatorSet textCloseAnimatorSet = new AnimatorSet();
    textCloseAnimatorSet.playSequentially(textAnimations);

    AnimatorSet imageCloseAnimatorSet = new AnimatorSet();
    imageCloseAnimatorSet.playSequentially(imageAnimations);

    AnimatorSet animatorFullSet = new AnimatorSet();
    animatorFullSet.playTogether(imageCloseAnimatorSet, textCloseAnimatorSet);
    animatorFullSet.setDuration(mAnimationDurationMilis);
    animatorFullSet.addListener(mCloseOpenAnimatorListener);
    animatorFullSet.setStartDelay(0);
    animatorFullSet.setInterpolator(new HesitateInterpolator());
    return animatorFullSet;
}
项目:MeiZi_App    文件:VideoImageView.java   
private void nextAnimation() {
    AnimatorSet anim = new AnimatorSet();
    if (scale) {
        anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.5f, 1f),
                ObjectAnimator.ofFloat(this, "scaleY", 1.5f, 1f));
    } else {
        anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1, 1.5f),
                ObjectAnimator.ofFloat(this, "scaleY", 1, 1.5f));
    }
    anim.setDuration(10987);
    anim.addListener(this);
    anim.start();
    scale = !scale;
}
项目:ListViewAnimations    文件:SwipeTouchListener.java   
/**
 * Animates the pending {@link android.view.View} back to its original position.
 */
private void restoreCurrentViewTranslation() {
    if (mCurrentView == null) {
        return;
    }

    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(mSwipingView, TRANSLATION_X, 0);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mSwipingView, ALPHA, 1);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new RestoreAnimatorListener(mCurrentView, mCurrentPosition));
    animatorSet.start();
}
项目:ListViewAnimations    文件:AnimateAdditionAdapter.java   
@Override
@NonNull
public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) {
    final View view = super.getView(position, convertView, parent);

    if (mInsertQueue.getActiveIndexes().contains(position)) {
        int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.MATCH_PARENT, View.MeasureSpec.AT_MOST);
        int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED);
        view.measure(widthMeasureSpec, heightMeasureSpec);

        int originalHeight = view.getMeasuredHeight();

        ValueAnimator heightAnimator = ValueAnimator.ofInt(1, originalHeight);
        heightAnimator.addUpdateListener(new HeightUpdater(view));

        Animator[] customAnimators = getAdditionalAnimators(view, parent);
        Animator[] animators = new Animator[customAnimators.length + 1];
        animators[0] = heightAnimator;
        System.arraycopy(customAnimators, 0, animators, 1, customAnimators.length);

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(animators);

        ViewHelper.setAlpha(view, 0);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);

        AnimatorSet allAnimatorsSet = new AnimatorSet();
        allAnimatorsSet.playSequentially(animatorSet, alphaAnimator);

        allAnimatorsSet.setDuration(mInsertionAnimationDurationMs);
        allAnimatorsSet.addListener(new ExpandAnimationListener(position));
        allAnimatorsSet.start();
    }

    return view;
}
项目:CanDialog    文件:AnimatedVectorDrawable.java   
public static boolean canReverse(Animator a) {
    if (a instanceof AnimatorSet) {
        final ArrayList<Animator> animators = ((AnimatorSet)a).getChildAnimations();
        for(Animator anim: animators) {
            if(!canReverse(anim)) {
                return false;
            }
        }
    } else if (a instanceof ValueAnimator) {
        return true;
    }

    return false;
}
项目:CanDialog    文件:AnimatedVectorDrawable.java   
private void reverse(Animator a) {
    if (a instanceof AnimatorSet) {
        final ArrayList<Animator> animators = ((AnimatorSet)a).getChildAnimations();
        for(Animator anim: animators) {
            reverse(anim);
        }
    } else if (a instanceof ValueAnimator) {
        ((ValueAnimator)a).reverse();
    }
}