当前位置: 首页>>代码示例>>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;未经允许,请勿转载。