本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
});
}
示例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();
}
}