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