本文整理汇总了Java中android.animation.ValueAnimator.setIntValues方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.setIntValues方法的具体用法?Java ValueAnimator.setIntValues怎么用?Java ValueAnimator.setIntValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.setIntValues方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAnim
import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
* 给背景设置一个动画
*
* @param endProgress 动画的结束进度
* @param endCallback 动画结束时触发
*/
private void startAnim(float endProgress, final Runnable endCallback) {
// 获取一个最终的颜色
int finalColor = Resource.Color.WHITE; // UiCompat.getColor(getResources(), R.color.white);
// 运算当前进度的颜色
ArgbEvaluator evaluator = new ArgbEvaluator();
int endColor = (int) evaluator.evaluate(endProgress, mBgDrawable.getColor(), finalColor);
// 构建一个属性动画
ValueAnimator valueAnimator = ObjectAnimator.ofObject(this, property, evaluator, endColor);
valueAnimator.setDuration(1500); // 时间
valueAnimator.setIntValues(mBgDrawable.getColor(), endColor); // 开始结束值
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// 结束时触发
endCallback.run();
}
});
valueAnimator.start();
}
示例2: SLTouchListener
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public SLTouchListener(SphereLayout sphereLayout) {
mSphereLayout = sphereLayout;
mTouchSlop = ViewConfiguration.get(mSphereLayout.getContext()).getScaledTouchSlop();
mInterpolator = new SpringInterpolator();
mState = new RotateState();
mRotateAnimator = new ValueAnimator();
mRotateAnimator.setInterpolator(mInterpolator);
mRotateAnimator.setIntValues(MAX_ROTATE_DEGREE, 0);
mRotateAnimator.setDuration(DURATION);
mRotateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mState.rotateDegree = (Integer) animation.getAnimatedValue();
mSphereLayout.rotate(mState.direction, mState.rotateDegree);
}
});
mFixAnimator = new ValueAnimator();
mFixAnimator.setInterpolator(new DecelerateInterpolator());
}
示例3: createAppearBackgroundAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private Animator createAppearBackgroundAnimator() {
int startColor = ResourcesCompat.getColor(getResources(),
BACGROUND_TRANSPARENT_COLOR_RES,
getContext().getTheme()
);
int finColor = ResourcesCompat.getColor(getResources(),
BACKGROUND_COLOR_RES,
getContext().getTheme()
);
ValueAnimator anim = new ValueAnimator();
anim.setIntValues(startColor, finColor);
anim.setEvaluator(ArgbEvaluator.getInstance());
anim.setStartDelay(ANIMATION_DURATION / 2);
anim.setDuration(ANIMATION_DURATION / 2);
anim.addUpdateListener(animation -> {
int color = (int) animation.getAnimatedValue();
setBackgroundColor(color);
});
return anim;
}
示例4: recolorBackground
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static void recolorBackground(final View view,
final int startColor,
final int endColor,
final int duration) {
ValueAnimator anim = new ValueAnimator();
anim.setIntValues(startColor, endColor);
anim.setEvaluator(new ArgbEvaluator());
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
view.setBackgroundColor((Integer) animation.getAnimatedValue());
}
});
anim.setDuration(duration);
anim.start();
}
示例5: LineFadeIndicator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public LineFadeIndicator(DachshundTabLayout dachshundTabLayout) {
this.dachshundTabLayout = dachshundTabLayout;
valueAnimator = new ValueAnimator();
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.setDuration(DEFAULT_DURATION);
valueAnimator.addUpdateListener(this);
valueAnimator.setIntValues(0,255);
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
rectF = new RectF();
startXLeft = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
startXRight = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());
edgeRadius = -1;
}
示例6: createValueAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static ValueAnimator createValueAnimator(AnimatedDrawable2 animatedDrawable) {
int loopCount = animatedDrawable.getLoopCount();
ValueAnimator animator = new ValueAnimator();
animator.setIntValues(0, (int) animatedDrawable.getLoopDurationMs());
animator.setDuration(animatedDrawable.getLoopDurationMs());
animator.setRepeatCount(
loopCount != AnimationInformation.LOOP_COUNT_INFINITE ? loopCount : ValueAnimator.INFINITE);
animator.setRepeatMode(ValueAnimator.RESTART);
// Use a linear interpolator
animator.setInterpolator(null);
ValueAnimator.AnimatorUpdateListener animatorUpdateListener =
createAnimatorUpdateListener(animatedDrawable);
animator.addUpdateListener(animatorUpdateListener);
return animator;
}
示例7: createColorAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
* this method replace for ValueAnimator.ofArgb() support below sdk 6.0
*
* @param values
* @return
*/
private ValueAnimator createColorAnimation(int... values) {
ValueAnimator colorAnimation = new ValueAnimator();
colorAnimation.setIntValues(values);
colorAnimation.setEvaluator(new ArgbEvaluator());
colorAnimation.setDuration(ANIMATION_DURATION);
return colorAnimation;
}
示例8: animateColors
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void animateColors(int previousColor, int color) {
ValueAnimator anim = new ValueAnimator();
anim.setIntValues(previousColor, color);
anim.setEvaluator(new ArgbEvaluator());
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
setColors((Integer) valueAnimator.getAnimatedValue());
}
});
anim.setDuration(150);
anim.start();
}
示例9: showProgress
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void showProgress(int duration) {
if (isProgressShowing) {
return;
}
isProgressShowing = true;
status = Status.SHOWING;
final int bw = button.getMeasuredWidth();
buttonWidth = bw;
buttonText = button.getText().toString();
buttonBg = button.getBackground();
button.setEnabled(false);
button.setBackgroundResource(bgResId);
final int pw = progress.getMeasuredWidth();
ValueAnimator valueAnimator = new ValueAnimator();
valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
valueAnimator.setDuration(duration);
valueAnimator.setIntValues(bw, pw);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (status != Status.SHOWING) {
return;
}
int value = (int) animation.getAnimatedValue();
button.getLayoutParams().width = value;
button.requestLayout();
if (value == pw) {
progress.animate().alpha(1f).start();
status = Status.SHOWED;
}
}
});
//button.setText(null);
valueAnimator.start();
}
示例10: PointFadeIndicator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public PointFadeIndicator(DachshundTabLayout dachshundTabLayout) {
this.dachshundTabLayout = dachshundTabLayout;
valueAnimator = new ValueAnimator();
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.setDuration(DEFAULT_DURATION);
valueAnimator.addUpdateListener(this);
valueAnimator.setIntValues(0,255);
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
startX = (int) dachshundTabLayout.getChildXCenter(dachshundTabLayout.getCurrentPosition());
}
示例11: initBlinkingAnimators
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initBlinkingAnimators(final int index, ValueAnimator opacityAnimator) {
opacityAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
opacityAnimator.setIntValues(mInitialOpacity, mTargetOpacity, mInitialOpacity);
opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final int opacity = (int) animation.getAnimatedValue();
mAlphaOpacityList.set(index, opacity);
}
});
}
示例12: initShinyAnimators
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initShinyAnimators(final int index, ValueAnimator opacityAnimator) {
opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
opacityAnimator.setInterpolator(new DecelerateInterpolator(opacityDecelerateFactor));
opacityAnimator.setIntValues(255, 50, 255);
opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final int opacity = (int) animation.getAnimatedValue();
mAlphaOpacityList.set(index, opacity);
}
});
}
示例13: initAuraAnimators
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initAuraAnimators(final int index, ValueAnimator opacityAnimator) {
opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
opacityAnimator.setInterpolator(new AnticipateInterpolator(opacityDecelerateFactor));
opacityAnimator.setIntValues(255, 50, 255, 50);
opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final int opacity = (int) animation.getAnimatedValue();
mAlphaOpacityList.set(index, opacity);
}
});
}