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


Java AnimatorSet.setDuration方法代碼示例

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


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

示例1: startAnimation

import android.animation.AnimatorSet; //導入方法依賴的package包/類
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
    super.startAnimation(dynamicWeatherView, fromColor);
    ValueAnimator animator1 = ValueAnimator.ofFloat(0, 1);
    animator1.setInterpolator(new OvershootInterpolator());
    animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            speed = (float) animation.getAnimatedValue() * 32;
            rotate = (float) animation.getAnimatedValue();
        }
    });

    AnimatorSet animSet = new AnimatorSet();
    animSet.play(animator1);
    animSet.setDuration(1000);
    animSet.start();

}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:20,代碼來源:SandstormType.java

示例2: setHighlighted

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void setHighlighted(boolean value) {
    AnimatorSet animatorSet = new AnimatorSet();
    if (value) {
        animatorSet.playTogether(
                ObjectAnimator.ofFloat(this, "scaleX", 1.06f),
                ObjectAnimator.ofFloat(this, "scaleY", 1.06f));
    } else {
        animatorSet.playTogether(
                ObjectAnimator.ofFloat(this, "scaleX", 1.0f),
                ObjectAnimator.ofFloat(this, "scaleY", 1.0f));
        animatorSet.setStartDelay(40);
    }
    animatorSet.setDuration(120);
    animatorSet.setInterpolator(interpolator);
    animatorSet.start();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:17,代碼來源:ShutterButton.java

示例3: targetViewAnim

import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
 * 用於小圓點的放大縮小
 * @param view
 * @param type
 */
private void targetViewAnim(final View view, final int type){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator scaleX = null;
    ObjectAnimator scaleY = null;
    ObjectAnimator alpha = null;
    if (type == ANIM_OUT){
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",SCALE_MIN,mScale_max);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",SCALE_MIN,mScale_max);
        alpha = ObjectAnimator.ofFloat(view,"alpha",mAlpha_min,ALPHA_MAX);
        animatorSet.setDuration(ANIM_OUT_TIME);
    }else{
        scaleX = ObjectAnimator.ofFloat(view,"scaleX",mScale_max,SCALE_MIN);
        scaleY = ObjectAnimator.ofFloat(view,"scaleY",mScale_max,SCALE_MIN);
        alpha = ObjectAnimator.ofFloat(view,"alpha",ALPHA_MAX,mAlpha_min);
        animatorSet.setDuration(ANIM_IN_TIME);
    }
    animatorSet.play(scaleX).with(scaleY).with(alpha);

    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.start();

}
 
開發者ID:LillteZheng,項目名稱:ViewPagerHelper,代碼行數:28,代碼來源:ZoomIndicator.java

示例4: runSwipeAnimation

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void runSwipeAnimation(long time) {
    cancelRunningAnimation();
    mSwipedAway = getTranslationX();

    ObjectAnimator swipe = ObjectAnimator.ofFloat(this, View.TRANSLATION_X,
            getTranslationX() > 0 ? getWidth() : -getWidth());
    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0.f);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(fadeOut, swipe);
    set.addListener(mCloseAnimatorListener);
    set.setDuration(Math.min(time, mDefaultAnimationDurationMs));
    set.start();

    mActiveAnimation = set;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:17,代碼來源:AccessibilityTabModelListItem.java

示例5: startAnimation

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void startAnimation() {
    Point startPoint = new Point(RADIUS, RADIUS);
    Point endPoint = new Point(getWidth() - RADIUS, getHeight() - RADIUS);
    ValueAnimator anim = ValueAnimator.ofObject(new PointEvaluator(), startPoint, endPoint);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            currentPoint = (Point) animation.getAnimatedValue();
            invalidate();
        }
    });
    ObjectAnimator anim2 = ObjectAnimator.ofObject(this, "color", new ColorEvaluator(),
            "#0000FF", "#FF0000");
    AnimatorSet animSet = new AnimatorSet();
    animSet.play(anim).with(anim2);
    animSet.setDuration(5000);
    animSet.start();
}
 
開發者ID:supremezzz,項目名稱:Supreme,代碼行數:19,代碼來源:MyAnimView.java

示例6: smoothScrollTo

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
    ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
    ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);

    yTranslate.addUpdateListener(new AnimatorUpdateListener()
    {
        @Override
        public void onAnimationUpdate(ValueAnimator animation)
        {
            if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
        }
    });

    AnimatorSet animators = new AnimatorSet();
    animators.setDuration(240L);
    animators.playTogether(xTranslate, yTranslate);
    if (listener != null) animators.addListener(listener);
    animators.start();
}
 
開發者ID:kfrozen,項目名稱:HeaderCollapsibleLayout,代碼行數:21,代碼來源:HeaderCollapsibleLayout.java

示例7: dismiss

import android.animation.AnimatorSet; //導入方法依賴的package包/類
void dismiss() {
    // Disable action button during animation.
    mActionButtonView.setEnabled(false);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(mAnimationDuration);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mParent.removeOnLayoutChangeListener(mLayoutListener);
            mParent.removeView(mView);
        }
    });
    Animator moveDown = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y,
            mView.getHeight() + getLayoutParams().bottomMargin);
    moveDown.setInterpolator(new DecelerateInterpolator());
    Animator fadeOut = ObjectAnimator.ofFloat(mView, View.ALPHA, 0f);
    fadeOut.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);

    animatorSet.playTogether(fadeOut, moveDown);
    startAnimatorOnSurfaceView(animatorSet);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:22,代碼來源:SnackbarView.java

示例8: NoticePopup

import android.animation.AnimatorSet; //導入方法依賴的package包/類
public NoticePopup(Context context, int width, int height) {
    super(context, width, height);
    setBackgroundColor(0x99000000);

    Menu = notice.getFMview(getContext(),false);
    back = new radiusSqure(Menu.width,Menu.height,0,0, Ui.cd.getHt(13));
    back.setColor(backgroundImg.Color0);
    Menu.InCenter(width,height);
    Menu.setBackgroundColor(0x00000000);
    addView(Menu);
    setAlpha(0);

    setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Ui.bk.back();
        }
    });

    Set = new AnimatorSet();
    Set.setInterpolator(Ui.cd.TH);
    Set.setDuration(200);
    Set.playTogether(
            ObjectAnimator.ofFloat(this, "Alpha", 1.0F)
    );
    Set.start();
}
 
開發者ID:KishanV,項目名稱:Android-Music-Player,代碼行數:28,代碼來源:NoticePopup.java

示例9: start

import android.animation.AnimatorSet; //導入方法依賴的package包/類
public void start(View view) {
    if (lastAnimator != null) {
        lastAnimator.removeAllListeners();
        lastAnimator.end();
        lastAnimator.cancel();
    }
    ObjectAnimator animX = ObjectAnimator.ofFloat(view, "scaleX", 1.6f, 1.0f);
    ObjectAnimator animY = ObjectAnimator.ofFloat(view, "scaleY", 1.6f, 1.0f);
    AnimatorSet animSet = new AnimatorSet();
    lastAnimator = animSet;
    animSet.setDuration(400);
    animSet.setInterpolator(new OvershootInterpolator());
    animSet.playTogether(animX, animY);
    animSet.start();
}
 
開發者ID:Yuphee,項目名稱:RewardLayout,代碼行數:16,代碼來源:NumAnim.java

示例10: initAnimator

import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
 * 初始化動畫操作
 */
private void initAnimator( ViewHolder holder){

    ObjectAnimator mItem = ObjectAnimator.ofFloat(holder.itemView, "translationX",0f, -60f);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.mImage, "scaleX",1f, 0f);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.mImage, "scaleY",1f, 0f);
    AnimatorSet animSet = new AnimatorSet();
    animSet.play(mItem).with(scaleX).with(scaleY);
    animSet.setDuration(0);
    animSet.start();
}
 
開發者ID:android-jian,項目名稱:topnews,代碼行數:14,代碼來源:UserKeepAdapter.java

示例11: doHeartBeat

import android.animation.AnimatorSet; //導入方法依賴的package包/類
/**
 * 心跳動畫
 * @param view  視圖
 * @param duration  時間
 */
public static void doHeartBeat(View view, int duration) {
    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 1.4f, 0.9f, 1.0f),
            ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 1.4f, 0.9f, 1.0f)
    );
    set.setDuration(duration);
    set.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:AnimateHelper.java

示例12: dismissViewUp

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void dismissViewUp(final View view){
    ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationY", 0f, -100f);
    ObjectAnimator animator2 = ObjectAnimator.ofFloat(view,"alpha",1f,0f);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(500);
    set.playTogether(animator1, animator2);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            view.setVisibility(View.GONE);
        }
    });
    set.start();
}
 
開發者ID:lai233333,項目名稱:MyDemo,代碼行數:15,代碼來源:MoviePhotoActivity.java

示例13: createAnimator

import android.animation.AnimatorSet; //導入方法依賴的package包/類
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    transition.setDuration(300);
    return transition;
}
 
開發者ID:AdityaAnand1,項目名稱:Morphing-Material-Dialogs,代碼行數:40,代碼來源:MorphDialogToFab.java

示例14: animateSunblind

import android.animation.AnimatorSet; //導入方法依賴的package包/類
public static void animateSunblind(RecyclerView.ViewHolder holder, boolean goesDown) {
    int holderHeight = holder.itemView.getHeight();
    holder.itemView.setPivotY(goesDown == true ? 0 : holderHeight);
    holder.itemView.setPivotX(holder.itemView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0);
    ObjectAnimator animatorRotation = ObjectAnimator.ofFloat(holder.itemView, "rotationX", goesDown == true ? -90f : 90, 0f);
    ObjectAnimator animatorScaleX = ObjectAnimator.ofFloat(holder.itemView, "scaleX", 0.5f, 1f);
    animatorSet.playTogether(animatorTranslateY, animatorRotation, animatorScaleX);
    animatorSet.setInterpolator(new DecelerateInterpolator(1.1f));
    animatorSet.setDuration(1000);
    animatorSet.start();
}
 
開發者ID:vikasdesale,項目名稱:Wings2K16,代碼行數:14,代碼來源:AnimationUtils.java

示例15: animateBackground

import android.animation.AnimatorSet; //導入方法依賴的package包/類
private void animateBackground(boolean emptyQuery) {
  int toAlpha = emptyQuery ? 0 : 1;
  ObjectAnimator[] objectAnimators = new ObjectAnimator[2];
  objectAnimators[0] = ObjectAnimator.ofFloat(emptySearchView, "alpha", toAlpha);
  objectAnimators[1] = ObjectAnimator.ofFloat(searchResult, "alpha", toAlpha);
  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.playTogether(objectAnimators);
  animatorSet.setDuration(shortAnimTime);
  animatorSet.start();
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:11,代碼來源:SearchActivity.java


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