当前位置: 首页>>代码示例>>Java>>正文


Java Animator.setStartDelay方法代码示例

本文整理汇总了Java中android.animation.Animator.setStartDelay方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.setStartDelay方法的具体用法?Java Animator.setStartDelay怎么用?Java Animator.setStartDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.Animator的用法示例。


在下文中一共展示了Animator.setStartDelay方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startAnimators

import android.animation.Animator; //导入方法依赖的package包/类
public static void startAnimators(final View view, int startOffsetX, int startOffsetY, long delay) {
    if (view.getVisibility() == View.VISIBLE && view.getAlpha() != 0f) {
        view.clearAnimation();
        view.animate().cancel();
        final Resources res = view.getResources();
        final float endAlpha = view.getAlpha();
        final float endTranslateX = view.getTranslationX();
        final float endTranslateY = view.getTranslationY();
        view.setAlpha(0);
        final Animator fade = ObjectAnimator.ofFloat(view, View.ALPHA, endAlpha);
        fade.setDuration(res.getInteger(R.integer.material_in_fade_anim_duration));
        fade.setInterpolator(new AccelerateInterpolator());
        fade.setStartDelay(delay);
        fade.start();
        ViewPropertyAnimator slide = view.animate();
        if (startOffsetY != 0) {
            view.setTranslationY(startOffsetY);
            slide.translationY(endTranslateY);
        } else {
            view.setTranslationX(startOffsetX);
            slide.translationX(endTranslateX);
        }
        slide.setInterpolator(new DecelerateInterpolator(2));
        slide.setDuration(res.getInteger(R.integer.material_in_slide_anim_duration));
        slide.setStartDelay(delay);
        slide.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationCancel(Animator animation) {
                if (fade.isStarted()) {
                    fade.cancel();
                }
                view.setAlpha(endAlpha);
                view.setTranslationX(endTranslateX);
                view.setTranslationY(endTranslateY);
            }
        });
        slide.start();
    }
}
 
开发者ID:rumaan,项目名称:file.io-app,代码行数:40,代码来源:MaterialIn.java

示例2: createFor

import android.animation.Animator; //导入方法依赖的package包/类
public Animator createFor(View view) {
    final Animator animation = Flubber.getAnimation(this, view);

    animation.setDuration(duration);
    animation.setStartDelay(delay);

    if (autoStart) {
        animation.start();
    }

    if (animatorListener != null) {
        animation.addListener(animatorListener);
    }

    return animation;
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:17,代码来源:AnimationBody.java

示例3: startTranslationYAnimation

import android.animation.Animator; //导入方法依赖的package包/类
public static void startTranslationYAnimation(View view, long delay, long duration,
        float endTranslationY, Interpolator interpolator) {
    Animator translationAnim;
    if (view.isHardwareAccelerated() && isSupportRenderNodeAnimator()) {
        RenderNodeAnimator translationAnimRt = new RenderNodeAnimator(
                RenderNodeAnimator.TRANSLATION_Y, endTranslationY);
        translationAnimRt.setTarget(view);
        translationAnim = translationAnimRt;
    } else {
        translationAnim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
                view.getTranslationY(), endTranslationY);
    }
    translationAnim.setInterpolator(interpolator);
    translationAnim.setDuration(duration);
    translationAnim.setStartDelay(delay);
    translationAnim.start();
}
 
开发者ID:Trumeet,项目名称:Animations,代码行数:18,代码来源:AppearAnimationUtils.java

示例4: createAnimations

import android.animation.Animator; //导入方法依赖的package包/类
private Animator[] createAnimations() {
    Animator[] animators = new Animator[size];
    for (int i = 0; i < spots.length; i++) {
        Animator move = ObjectAnimator.ofFloat(spots[i], "xFactor", 0, 1);
        move.setDuration(DURATION);
        move.setInterpolator(new HesitateInterpolator());
        move.setStartDelay(DELAY * i);
        animators[i] = move;
    }
    return animators;
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:12,代码来源:SpotsDialog.java

示例5: addAnimation

import android.animation.Animator; //导入方法依赖的package包/类
private static void addAnimation(Collection<Animator> animators, View view, TimeInterpolator interpolator, int duration, int delay) {
    Animator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, 0f, 1f);
    scaleX.setInterpolator(interpolator);
    scaleX.setDuration(duration);
    scaleX.setStartDelay(delay);
    animators.add(scaleX);

    Animator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, 0f, 1f);
    scaleY.setInterpolator(interpolator);
    scaleY.setDuration(duration);
    scaleY.setStartDelay(delay);
    animators.add(scaleY);
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:14,代码来源:FlatPlayerPlaybackControlsFragment.java

示例6: getAnimatorSetForSort

import android.animation.Animator; //导入方法依赖的package包/类
private AnimatorSet getAnimatorSetForSort(Animator[] animators, SortFunction sortFunction) {
    List<SpruceTimedView> childrenWithTime;
    List<View> children = new ArrayList<>();

    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        children.add(viewGroup.getChildAt(i));
    }

    sortFunction.sortChildren(viewGroup, children);
    childrenWithTime = sortFunction.getViewListWithTimeOffsets(viewGroup, children);
    animatorSet = new AnimatorSet();
    List<Animator> animatorsList = new ArrayList<>();

    for (SpruceTimedView childView : childrenWithTime) {
        for (Animator animatorChild : animators) {
            Animator animatorCopy = animatorChild.clone();
            animatorCopy.setTarget(childView.getView());
            animatorCopy.start();
            animatorCopy.cancel();
            animatorCopy.setStartDelay(childView.getTimeOffset());
            animatorsList.add(animatorCopy);
        }
    }
    animatorSet.playTogether(animatorsList);

    return animatorSet;
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:28,代码来源:Spruce.java

示例7: createAnimator

import android.animation.Animator; //导入方法依赖的package包/类
public static Animator createAnimator(View view, float toAlpha, int durationMillis, int startDelayMillis, AnimatorListener listener) {
    Animator animator = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), toAlpha);
    animator.setDuration((long) durationMillis);
    animator.setStartDelay((long) startDelayMillis);
    animator.addListener(listener);
    return animator;
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:8,代码来源:FadeAnimationController.java

示例8: onBindViewHolder

import android.animation.Animator; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    mAdapter.onBindViewHolder(holder, position);
    loadTime = System.currentTimeMillis();
    int adapterPosition = holder.getAdapterPosition();
    boolean delay = false;

    if (!isFirstOnly || adapterPosition > mLastPosition) {
        if ((loadTime - firstTime) < 10) {
            delay = true;
            count++;
        } else {
            count = 0;
        }
        for (Animator anim : getAnimators(holder.itemView)) {
            anim.setDuration(mDuration).start();
            if (delay && enableDelay) {
                anim.setStartDelay(count * 30);
            }
            anim.setInterpolator(mInterpolator);
        }
        mLastPosition = adapterPosition;
    } else {
        ViewHelper.clear(holder.itemView);
    }
    firstTime = loadTime;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:28,代码来源:AnimationAdapter.java

示例9: trimNotifications

import android.animation.Animator; //导入方法依赖的package包/类
public void trimNotifications(Map<PackageUserKey, BadgeInfo> updatedBadges) {
    if (mNotificationItemView == null) {
        return;
    }
    ItemInfo originalInfo = (ItemInfo) mOriginalIcon.getTag();
    BadgeInfo badgeInfo = updatedBadges.get(PackageUserKey.fromItemInfo(originalInfo));
    if (badgeInfo == null || badgeInfo.getNotificationKeys().size() == 0) {
        AnimatorSet removeNotification = LauncherAnimUtils.createAnimatorSet();
        final int duration = getResources().getInteger(
                R.integer.config_removeNotificationViewDuration);
        final int spacing = getResources().getDimensionPixelSize(R.dimen.popup_items_spacing);
        removeNotification.play(reduceNotificationViewHeight(
                mNotificationItemView.getHeightMinusFooter() + spacing, duration));
        final View removeMarginView = mIsAboveIcon ? getItemViewAt(getItemCount() - 2)
                : mNotificationItemView;
        if (removeMarginView != null) {
            ValueAnimator removeMargin = ValueAnimator.ofFloat(1, 0).setDuration(duration);
            removeMargin.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    ((MarginLayoutParams) removeMarginView.getLayoutParams()).bottomMargin
                            = (int) (spacing * (float) valueAnimator.getAnimatedValue());
                }
            });
            removeNotification.play(removeMargin);
        }
        Animator fade = ObjectAnimator.ofFloat(mNotificationItemView, ALPHA, 0)
                .setDuration(duration);
        fade.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                removeView(mNotificationItemView);
                mNotificationItemView = null;
                if (getItemCount() == 0) {
                    close(false);
                    return;
                }
            }
        });
        removeNotification.play(fade);
        final long arrowScaleDuration = getResources().getInteger(
                R.integer.config_deepShortcutArrowOpenDuration);
        Animator hideArrow = createArrowScaleAnim(0).setDuration(arrowScaleDuration);
        hideArrow.setStartDelay(0);
        Animator showArrow = createArrowScaleAnim(1).setDuration(arrowScaleDuration);
        showArrow.setStartDelay((long) (duration - arrowScaleDuration * 1.5));
        removeNotification.playSequentially(hideArrow, showArrow);
        removeNotification.start();
        return;
    }
    mNotificationItemView.trimNotifications(NotificationKeyData.extractKeysOnly(
            badgeInfo.getNotificationKeys()));
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:54,代码来源:PopupContainerWithArrow.java

示例10: populateUrlClearFocusingAnimatorSet

import android.animation.Animator; //导入方法依赖的package包/类
private void populateUrlClearFocusingAnimatorSet(List<Animator> animators) {
    Animator animator = ObjectAnimator.ofFloat(this, mUrlFocusChangePercentProperty, 0f);
    animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
    animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
    animators.add(animator);

    animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, TRANSLATION_X, 0);
    animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
    animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS);
    animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
    animators.add(animator);

    animator = ObjectAnimator.ofFloat(mMenuButtonWrapper, ALPHA, 1);
    animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
    animator.setStartDelay(URL_CLEAR_FOCUS_MENU_DELAY_MS);
    animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
    animators.add(animator);

    if (mToggleTabStackButton != null) {
        animator = ObjectAnimator.ofFloat(mToggleTabStackButton, TRANSLATION_X, 0);
        animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
        animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS);
        animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
        animators.add(animator);

        animator = ObjectAnimator.ofFloat(mToggleTabStackButton, ALPHA, 1);
        animator.setDuration(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
        animator.setStartDelay(URL_CLEAR_FOCUS_TABSTACK_DELAY_MS);
        animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
        animators.add(animator);
    }

    for (int i = 0; i < mLocationBar.getChildCount(); i++) {
        View childView = mLocationBar.getChildAt(i);
        if (childView == mLocationBar.getFirstViewVisibleWhenFocused()) break;
        animator = ObjectAnimator.ofFloat(childView, ALPHA, 1);
        animator.setStartDelay(URL_FOCUS_TOOLBAR_BUTTONS_DURATION_MS);
        animator.setDuration(URL_CLEAR_FOCUS_MENU_DELAY_MS);
        animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
        animators.add(animator);
    }

    if (isLocationBarShownInNTP() && mNtpSearchBoxScrollPercent == 0f) return;

    // The call to getLayout() can return null briefly during text changes, but as it
    // is only needed for RTL calculations, we proceed if the location bar is showing
    // LTR content.
    boolean isLocationBarRtl = ApiCompatibilityUtils.isLayoutRtl(mLocationBar);
    if (!isLocationBarRtl || mUrlBar.getLayout() != null) {
        int urlBarStartScrollX = 0;
        if (isLocationBarRtl) {
            urlBarStartScrollX = (int) mUrlBar.getLayout().getPrimaryHorizontal(0);
            urlBarStartScrollX -= mUrlBar.getWidth();
        }

        // If the scroll position matches the current scroll position, do not trigger
        // this animation as it will cause visible jumps when going from cleared text
        // back to page URLs (despite it continually calling setScrollX with the same
        // number).
        if (mUrlBar.getScrollX() != urlBarStartScrollX) {
            animator = ObjectAnimator.ofInt(mUrlBar,
                    buildUrlScrollProperty(mLocationBar, isLocationBarRtl), urlBarStartScrollX);
            animator.setDuration(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
            animator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
            animators.add(animator);
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:69,代码来源:ToolbarPhone.java


注:本文中的android.animation.Animator.setStartDelay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。