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


Java AnimatorSet.setDuration方法代碼示例

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


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

示例1: 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

示例2: 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:HuTianQi,項目名稱:QQ,代碼行數:24,代碼來源:ResideMenu.java

示例3: 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

示例4: 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

示例5: 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

示例6: swapImage

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
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();
}
 
開發者ID:zpwan110,項目名稱:Android-ParallaxHeaderViewPager-master,代碼行數:27,代碼來源:KenBurnsSupportView.java

示例7: getPullDownAnimIn

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
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;
    }
 
開發者ID:zzz40500,項目名稱:Android-PullToNextLayout,代碼行數:19,代碼來源:SimpleAnimation.java

示例8: getPullUpAnimIn

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
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;
    }
 
開發者ID:zzz40500,項目名稱:Android-PullToNextLayout,代碼行數:18,代碼來源:SimpleAnimation.java

示例9: freeFall

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

示例10: setupAnimation

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

示例11: pressView

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
/**
 * 落地擠壓
 */
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();
}
 
開發者ID:SatanFu,項目名稱:OpenUCLoading,代碼行數:22,代碼來源:LoadingView.java

示例12: setOpenCloseAnimation

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

示例13: nextAnimation

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
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;
}
 
開發者ID:benchegnzhou,項目名稱:MeiZi_App,代碼行數:15,代碼來源:VideoImageView.java

示例14: restoreCurrentViewTranslation

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

示例15: addAnimation

import com.nineoldandroids.animation.AnimatorSet; //導入方法依賴的package包/類
private void addAnimation(View view) {
    float[] vaules = new float[]{0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.5f, 0.6f, 0.65f, 0.7f, 0.8f, 0.7f, 0.65f, 0.6f, 0.5f};
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(view, "scaleX", vaules), ObjectAnimator.ofFloat(view, "scaleY", vaules));
    set.setDuration(150);
    set.start();
}
 
開發者ID:1anc3r,項目名稱:AirFree-Client,代碼行數:8,代碼來源:PictureChildAdapter.java


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