當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimatorSet類代碼示例

本文整理匯總了Java中com.nineoldandroids.animation.AnimatorSet的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorSet類的具體用法?Java AnimatorSet怎麽用?Java AnimatorSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnimatorSet類屬於com.nineoldandroids.animation包,在下文中一共展示了AnimatorSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fillOpenClosingAnimations

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:zongkaili,項目名稱:MenuSet,代碼行數:22,代碼來源:MenuAdapter.java

示例2: undo

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:sathishmscict,項目名稱:ListViewAnimations,代碼行數:26,代碼來源:SwipeUndoTouchListener.java

示例3: flingView

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:sathishmscict,項目名稱:ListViewAnimations,代碼行數:23,代碼來源:SwipeTouchListener.java

示例4: animateView

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:sathishmscict,項目名稱:ListViewAnimations,代碼行數:21,代碼來源:ViewAnimator.java

示例5: startActivityAnimation

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
@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();
}
 
開發者ID:fanwucoder,項目名稱:mvpChat,代碼行數:18,代碼來源:EditTextActivity.java

示例6: animateView

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
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);
}
 
開發者ID:hezhubo,項目名稱:HPlayer,代碼行數:25,代碼來源:AnimationAdapter.java

示例7: buildScaleDownAnimation

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:alicance,項目名稱:MyScse-Client,代碼行數:27,代碼來源:ResideMenu.java

示例8: buildScaleUpAnimation

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:alicance,項目名稱:MyScse-Client,代碼行數:24,代碼來源:ResideMenu.java

示例9: doAnimateOpen

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 打開菜單的動畫
 * @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();
}
 
開發者ID:DIY-green,項目名稱:AndroidStudyDemo,代碼行數:28,代碼來源:NineOldAndroidsActivity.java

示例10: startBlurImageAppearAnimator

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
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();
}
 
開發者ID:cowthan,項目名稱:AyoSunny,代碼行數:22,代碼來源:BlurLayout.java

示例11: startBlurImageDisappearAnimator

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
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();
}
 
開發者ID:cowthan,項目名稱:AyoSunny,代碼行數:21,代碼來源:BlurLayout.java

示例12: onExpandAnimator

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
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});
    }

}
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:21,代碼來源:MyRapidFloatingActionContentLabelList.java

示例13: onCollapseAnimator

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
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});
    }

}
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:21,代碼來源:MyRapidFloatingActionContentLabelList.java

示例14: onExpandAnimator

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:wangjiegulu,項目名稱:RapidFloatingActionButton,代碼行數:19,代碼來源:RapidFloatingActionContentLabelList.java

示例15: openMenu

import com.nineoldandroids.animation.AnimatorSet; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:dxjia,項目名稱:GifAssistant,代碼行數:20,代碼來源:ResideMenu.java


注:本文中的com.nineoldandroids.animation.AnimatorSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。