本文整理了Java中android.animation.ObjectAnimator.ofArgb()
方法的一些代码示例,展示了ObjectAnimator.ofArgb()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.ofArgb()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:ofArgb
暂无
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static ObjectAnimator ofArgb(@Nullable Object target, @NonNull String propertyName,
int... values) {
return ObjectAnimator.ofArgb(target, propertyName, values);
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static <T> ObjectAnimator ofArgb(@Nullable T target,
@NonNull Property<T, Integer> property, int... values) {
return ObjectAnimator.ofArgb(target, property, values);
}
代码示例来源:origin: fython/MaterialStepperView
static ObjectAnimator createArgbAnimator(View view, String propertyName, int startColor, int endColor) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return ObjectAnimator.ofObject(view, propertyName, new TypeEvaluator() {
@Override
public Object evaluate(float fraction, Object startValue, Object endValue) {
int startInt = (Integer) startValue;
int startA = (startInt >> 24) & 0xff;
int startR = (startInt >> 16) & 0xff;
int startG = (startInt >> 8) & 0xff;
int startB = startInt & 0xff;
int endInt = (Integer) endValue;
int endA = (endInt >> 24) & 0xff;
int endR = (endInt >> 16) & 0xff;
int endG = (endInt >> 8) & 0xff;
int endB = endInt & 0xff;
return (startA + (int)(fraction * (endA - startA))) << 24 |
(startR + (int)(fraction * (endR - startR))) << 16 |
(startG + (int)(fraction * (endG - startG))) << 8 |
(startB + (int)(fraction * (endB - startB)));
}
}, startColor, endColor);
} else {
return ObjectAnimator.ofArgb(view, propertyName, startColor, endColor);
}
}
代码示例来源:origin: hitherejoe/animate
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
代码示例来源:origin: nickbutcher/plaid
endValues.view.setBackground(background);
final Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
final Animator corners =
ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);
代码示例来源:origin: hitherejoe/animate
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
代码示例来源:origin: hitherejoe/animate
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS,
endCornerRadius);
代码示例来源:origin: hitherejoe/animate
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS,
endCornerRadius);
代码示例来源:origin: OCNYang/Android-Animation-Set
/**
* ObjectAnimator usage
*
* @param b
* @return
*/
public ObjectAnimator getObjectAnimator(boolean b) {
if (b) {
ObjectAnimator bgColorAnimator = ObjectAnimator.ofArgb(mPuppet,
"backgroundColor",
0xff009688, 0xff795548);
bgColorAnimator.setRepeatCount(1);
bgColorAnimator.setDuration(3000);
bgColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
bgColorAnimator.setStartDelay(0);
return bgColorAnimator;
} else {
ObjectAnimator rotationXAnimator = ObjectAnimator.ofFloat(mPuppet,
"rotationX",
0f, 360f);
rotationXAnimator.setRepeatCount(1);
rotationXAnimator.setDuration(3000);
rotationXAnimator.setRepeatMode(ValueAnimator.REVERSE);
return rotationXAnimator;
}
}
代码示例来源:origin: AdityaAnand1/Morphing-Material-Dialogs
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);
代码示例来源:origin: lovejjfg/Circle
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startBackGround(int centerX,int centerY) {
AnimatorSet showScrim = new AnimatorSet();
showScrim.playTogether(
ViewAnimationUtils.createCircularReveal(
scrim,
centerX,
centerY,
0,
(float) Math.hypot(display.getWidth(), display.getHeight())),
ObjectAnimator.ofArgb(
scrim, "backgroundColor",
Color.GRAY,
getActivity().getResources().getColor(R.color.gray_1),
getActivity().getResources().getColor(R.color.transWhite)));
showScrim.setDuration(1000L);
showScrim.setInterpolator(linearOutSlowInInterpolator);
showScrim.start();
}
代码示例来源:origin: AdityaAnand1/Morphing-Material-Dialogs
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);
代码示例来源:origin: klinker24/launcher3
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
int finalAlpha = getAlphaForState(toState);
if (targetAnim == null) {
mBgPaint.setAlpha(finalAlpha);
invalidate();
} else {
ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
invalidate();
}
});
targetAnim.play(anim);
}
}
代码示例来源:origin: klinker24/Android-Blur-Launcher
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
int finalAlpha = getAlphaForState(toState);
if (targetAnim == null) {
mBgPaint.setAlpha(finalAlpha);
invalidate();
} else {
ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
invalidate();
}
});
targetAnim.play(anim);
}
}
代码示例来源:origin: RealMoMo/Study_Android_Demo
/**
* ObjectAnimator usage
*
* @param b
* @return
*/
public ObjectAnimator getObjectAnimator(boolean b) {
if (b) {
ObjectAnimator bgColorAnimator = ObjectAnimator.ofArgb(mPuppet,
"backgroundColor",
0xff009688, 0xff795548);
bgColorAnimator.setRepeatCount(1);
bgColorAnimator.setDuration(3000);
bgColorAnimator.setRepeatMode(ValueAnimator.REVERSE);
bgColorAnimator.setStartDelay(0);
return bgColorAnimator;
} else {
ObjectAnimator rotationXAnimator = ObjectAnimator.ofFloat(mPuppet,
"rotationX",
0f, 360f);
rotationXAnimator.setRepeatCount(1);
rotationXAnimator.setDuration(3000);
rotationXAnimator.setRepeatMode(ValueAnimator.REVERSE);
return rotationXAnimator;
}
}
代码示例来源:origin: naman14/Hacktoberfest-Android
private void hideFilterContainer() {
AnimatorSet hideConfirmation = new AnimatorSet();
hideConfirmation.playTogether(
ViewAnimationUtils.createCircularReveal(confirmSaveContainer,
confirmSaveContainer.getWidth() / 2,
confirmSaveContainer.getHeight() / 2,
confirmSaveContainer.getWidth() / 2,
fab.getWidth() / 2),
ObjectAnimator.ofArgb(resultsScrim,
Utils.BACKGROUND_COLOR,
Color.TRANSPARENT));
hideConfirmation.setDuration(150L);
hideConfirmation.setInterpolator(AnimUtils.getFastOutSlowInInterpolator
(getActivity()));
hideConfirmation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
confirmSaveContainer.setVisibility(View.GONE);
resultsScrim.setVisibility(View.GONE);
fab.setVisibility(View.VISIBLE);
FabAnimationUtils.scaleIn(fab);
}
});
hideConfirmation.start();
}
代码示例来源:origin: fookwood/Launcher3
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateTextColor(int targetColor) {
if (mCurrentColorAnim != null) {
mCurrentColorAnim.cancel();
}
mCurrentColorAnim = new AnimatorSet();
mCurrentColorAnim.setDuration(DragView.COLOR_CHANGE_DURATION);
if (mSrcFilter == null) {
mSrcFilter = new ColorMatrix();
mDstFilter = new ColorMatrix();
mCurrentFilter = new ColorMatrix();
}
DragView.setColorScale(getTextColor(), mSrcFilter);
DragView.setColorScale(targetColor, mDstFilter);
ValueAnimator anim1 = ValueAnimator.ofObject(
new FloatArrayEvaluator(mCurrentFilter.getArray()),
mSrcFilter.getArray(), mDstFilter.getArray());
anim1.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mDrawable.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
invalidate();
}
});
mCurrentColorAnim.play(anim1);
mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, "textColor", targetColor));
mCurrentColorAnim.start();
}
代码示例来源:origin: klinker24/launcher3
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateTextColor(int targetColor) {
if (mCurrentColorAnim != null) {
mCurrentColorAnim.cancel();
}
mCurrentColorAnim = new AnimatorSet();
mCurrentColorAnim.setDuration(DragView.COLOR_CHANGE_DURATION);
if (mSrcFilter == null) {
mSrcFilter = new ColorMatrix();
mDstFilter = new ColorMatrix();
mCurrentFilter = new ColorMatrix();
}
DragView.setColorScale(getTextColor(), mSrcFilter);
DragView.setColorScale(targetColor, mDstFilter);
ValueAnimator anim1 = ValueAnimator.ofObject(
new FloatArrayEvaluator(mCurrentFilter.getArray()),
mSrcFilter.getArray(), mDstFilter.getArray());
anim1.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mDrawable.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
invalidate();
}
});
mCurrentColorAnim.play(anim1);
mCurrentColorAnim.play(ObjectAnimator.ofArgb(this, "textColor", targetColor));
mCurrentColorAnim.start();
}
代码示例来源:origin: DuanJiaNing/IndicatorView
@Override
public AnimatorSet onIndicatorPress(IndicatorView view, IndicatorView.IndicatorHolder target) {
int terminalColor = indicator2.getIndicatorColor();
int centerColor = Color.RED;
int centerColor2 = Color.BLUE;
ValueAnimator animator = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
animator = ObjectAnimator.ofArgb(target, "color", terminalColor, centerColor, centerColor2, terminalColor);
} else {
animator = ObjectAnimator.ofInt(target, "color", terminalColor, centerColor, centerColor2, terminalColor);
animator.setEvaluator(new ArgbEvaluator());
}
int terminalSize = indicator2.getIndicatorPixeSize();
int centerSize = indicator2.getIndicatorPixeSize() * 2;
ValueAnimator animatorH = ObjectAnimator.ofInt(target, "height", terminalSize, centerSize, terminalSize);
ValueAnimator animatorW = ObjectAnimator.ofInt(target, "width", terminalSize, centerSize, terminalSize);
AnimatorSet set = new AnimatorSet();
set.play(animator).with(animatorH).with(animatorW);
set.setDuration(1000); //播放时为700
return set;
}
});
代码示例来源:origin: DuanJiaNing/IndicatorView
@Override
public AnimatorSet onIndicatorSwitch(IndicatorView view, IndicatorView.IndicatorHolder target) {
int terminalColor = indicator4.getIndicatorColor();
int centerColor = indicator4.getDotColor();
ValueAnimator colorAnim = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
colorAnim = ObjectAnimator.ofArgb(target, "color", terminalColor, centerColor, terminalColor);
} else {
colorAnim = ObjectAnimator.ofInt(target, "color", terminalColor, centerColor, terminalColor);
colorAnim.setEvaluator(new ArgbEvaluator());
}
int terminalSize = indicator4.getIndicatorPixeSize();
int centerSize = indicator4.getIndicatorPixeSize() * 3 / 2;
ValueAnimator animatorH = ObjectAnimator.ofInt(target, "height", terminalSize, centerSize, terminalSize);
ValueAnimator animatorW = ObjectAnimator.ofInt(target, "width", terminalSize, centerSize, terminalSize);
AnimatorSet set = new AnimatorSet();
set.play(colorAnim).with(animatorH).with(animatorW);
set.setDuration(500);
return set;
}
});
内容来源于网络,如有侵权,请联系作者删除!