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


Java ValueAnimator.setDuration方法代码示例

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


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

示例1: endAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.25f, getWidth());
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
开发者ID:li-yu,项目名称:FakeWeather,代码行数:19,代码来源:HailType.java

示例2: createBallJumpAnimators

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public ArrayList<ValueAnimator> createBallJumpAnimators() {
    ArrayList<ValueAnimator> animators = new ArrayList<>();
    int[] delays = new int[]{70, 140, 210};
    for (int i = 0; i < 3; i++) {
        final int index = i;
        ValueAnimator scaleAnim = ValueAnimator.ofFloat(mTextBottomBorder, mTextBottomBorder - mBallRadius * 2, mTextBottomBorder);
        scaleAnim.setDuration(600);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                translateYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:hiwhitley,项目名称:DownloadProgressButton,代码行数:21,代码来源:DownloadProgressButton.java

示例3: createAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{400,200,0,200,400};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:23,代码来源:LineScalePulseOutRapidIndicator.java

示例4: dimBackground

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 调整窗口的透明度  1.0f,0.5f 变暗
 *
 * @param from    from>=0&&from<=1.0f
 * @param to      to>=0&&to<=1.0f
 * @param context 当前的activity
 */
public static void dimBackground(final float from, final float to, Activity context) {
    final Window window = context.getWindow();
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to);
    valueAnimator.setDuration(500);
    valueAnimator.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    WindowManager.LayoutParams params = window.getAttributes();
                    params.alpha = (Float) animation.getAnimatedValue();
                    window.setAttributes(params);
                }
            });
    valueAnimator.start();
}
 
开发者ID:zwmlibs,项目名称:BookReader-master,代码行数:23,代码来源:ScreenUtils.java

示例5: setUpAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override public void setUpAnimation() {
  for (int i = 0; i < numberOfLines; i++) {
    final int index = i;
    ValueAnimator scaleAnimator = ValueAnimator.ofFloat(1f, 1.5f, 1f);
    scaleAnimator.setDuration(1000);
    scaleAnimator.setStartDelay(i * 120);
    scaleAnimator.setRepeatCount(ValueAnimator.INFINITE);
    scaleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override public void onAnimationUpdate(ValueAnimator animation) {
        scaleY[index] = (float)animation.getAnimatedValue();
        if (invalidateListener != null) {
          invalidateListener.reDraw();
        }
      }
    });

    scaleAnimator.start();
  }
}
 
开发者ID:nntuyen,项目名称:mkloader,代码行数:20,代码来源:Pulse.java

示例6: setUpAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override public void setUpAnimation() {
  for (int i = 0; i < numberOfLine; i++) {
    final int index = i;

    ValueAnimator fadeAnimator = ValueAnimator.ofInt(126, 255, 126);
    fadeAnimator.setRepeatCount(ValueAnimator.INFINITE);
    fadeAnimator.setDuration(1000);
    fadeAnimator.setStartDelay(index * 120);
    fadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
      @Override public void onAnimationUpdate(ValueAnimator animation) {
        lines[index].setAlpha((int)animation.getAnimatedValue());
        if (invalidateListener != null) {
          invalidateListener.reDraw();
        }
      }
    });

    fadeAnimator.start();
  }
}
 
开发者ID:nntuyen,项目名称:mkloader,代码行数:21,代码来源:LineSpinner.java

示例7: createAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    ValueAnimator scaleAnim=ValueAnimator.ofFloat(0.5f,1,0.5f);
    scaleAnim.setDuration(1000);
    scaleAnim.setRepeatCount(-1);
    scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            scaleFloat = (float) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    scaleAnim.start();

    ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
    rotateAnim.setDuration(1000);
    rotateAnim.setRepeatCount(-1);
    rotateAnim.start();

    animators.add(scaleAnim);
    animators.add(rotateAnim);
    return animators;
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:25,代码来源:BallRotateIndicator.java

示例8: layoutSizeChangeHeightAnim

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 调整移动时,边框高度的变化
 * @param oldHeight
 * @param curHeight
 */
private void layoutSizeChangeHeightAnim(int oldHeight,float curHeight){
    ValueAnimator animator = ValueAnimator.ofFloat(oldHeight,curHeight);
  //  Log.d("zsr", "oldHeight, curHeight: " + (curHeight - oldHeight));
  //  int time = (int) (1.0f * Math.abs(curHeight - oldHeight)/1.5);
    animator.setDuration(mAnimationTime - mAnimationTimeWH);
    animator.setInterpolator(new LinearInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(final ValueAnimator animation) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    float height = (float) Float.parseFloat( animation.getAnimatedValue().toString());
                    ViewGroup.LayoutParams params = mView.getLayoutParams();
                    params.height = (int) height;
                    mView.setLayoutParams(params);
                    mView.setVisibility(VISIBLE);
                }
            });
        }
    });

    animator.start();
}
 
开发者ID:LillteZheng,项目名称:AndroidTvRectAnim,代码行数:30,代码来源:FlyBroadLayout.java

示例9: onClick

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new CirclePointEvaluator(), new Point(mStartXPoint, mStartYPoint),
            new Point(mEndXPoint, mEndYPoint));
    valueAnimator.setDuration(600);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Point point = (Point) animation.getAnimatedValue();
            mMoveXPoint = point.x;
            mMoveYPoint = point.y;
            invalidate();
        }
    });
    valueAnimator.start();

}
 
开发者ID:Lichenwei-Dev,项目名称:BezierView,代码行数:19,代码来源:BezierMoveView.java

示例10: onRefreshReleased

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onRefreshReleased(RefreshLayout layout, int headerHeight, int extendHeight) {
    mLastFirstBounds = 0;
    mWaveView.animationDropCircle();
    mCircleView.makeProgressTransparent();
    mCircleView.startProgress();
    ValueAnimator animator = ValueAnimator.ofFloat(0, 0);
    animator.setDuration(500);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mCircleView.setTranslationY(
                    mWaveView.getCurrentCircleCenterY() + mCircleView.getHeight() / 2.f);
        }
    });
    animator.start();
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:19,代码来源:WaveSwipeHeader.java

示例11: valueAnimator

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void valueAnimator() {
    ValueAnimator animator = ValueAnimator.ofObject(new CharEvaluator(), new Character('a'), new Character('z'));
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            char text = (char) animation.getAnimatedValue();
            content.setText(String.valueOf(text));
        }
    });
    animator.setDuration(5000);
    animator.setInterpolator(new BounceInterpolator());
    animator.start();
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:14,代码来源:AnimationDemoActivity.java

示例12: animLayoutByTime

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void animLayoutByTime(int start, int end, long time, AnimatorUpdateListener listener) {
        ValueAnimator va = ValueAnimator.ofInt(start, end);
        va.setInterpolator(new DecelerateInterpolator());
        va.addUpdateListener(listener);
        va.setDuration(time);
        va.start();
//        offerToQueue(va);
    }
 
开发者ID:Justson,项目名称:AgentWebX5,代码行数:9,代码来源:AnimProcessor.java

示例13: getTranslateYAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private ValueAnimator getTranslateYAnimation() {
    final ValueAnimator animator = ValueAnimator.ofFloat(mTranslateY, 0);
    animator.setDuration(animationDuration);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mTranslateY = (float) valueAnimator.getAnimatedValue();
        }
    });

    return animator;
}
 
开发者ID:miaoyongjun,项目名称:MVideo,代码行数:13,代码来源:DragVideoView.java

示例14: toSmallAnim

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void toSmallAnim(final View view) {
    final LinearLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    final ValueAnimator valueAnimator = ValueAnimator.ofInt(bigW, smallW);
    valueAnimator.setDuration(1000);
    valueAnimator.start();
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            params.width = params.height = (int) animation.getAnimatedValue();
            params.setMargins(10, 10, 10, 10);
            view.setLayoutParams(params);
        }
    });
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:15,代码来源:BaseLoginLayout2.java

示例15: unSelect

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void unSelect(boolean setActiveColor, int animationDuration) {
    isActive = false;

    ValueAnimator animator = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        animator = ValueAnimator.ofInt(containerView.getPaddingTop(), paddingTopInActive);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                    containerView.setPadding(containerView.getPaddingLeft(),
                            (Integer) valueAnimator.getAnimatedValue(),
                            containerView.getPaddingRight(),
                            containerView.getPaddingBottom());
                }
            }
        });
        animator.setDuration(animationDuration);
        animator.start();
    }

    labelView.setTextColor(mInActiveColor);
    iconView.setSelected(false);

    if (badgeItem != null) {
        badgeItem.unSelect();
    }
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:29,代码来源:BottomNavigationTab.java


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