use of android.animation.ArgbEvaluator in project NewPipe by TeamNewPipe.
the class AnimationUtils method animateBackgroundColor.
/**
* Animate the background color of a view
*/
public static void animateBackgroundColor(final View view, long duration, @ColorInt final int colorStart, @ColorInt final int colorEnd) {
if (DEBUG) {
Log.d(TAG, "animateBackgroundColor() called with: view = [" + view + "], duration = [" + duration + "], colorStart = [" + colorStart + "], colorEnd = [" + colorEnd + "]");
}
final int[][] EMPTY = new int[][] { new int[0] };
ValueAnimator viewPropertyAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
viewPropertyAnimator.setDuration(duration);
viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[] { (int) animation.getAnimatedValue() }));
}
});
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ViewCompat.setBackgroundTintList(view, new ColorStateList(EMPTY, new int[] { colorEnd }));
}
@Override
public void onAnimationCancel(Animator animation) {
onAnimationEnd(animation);
}
});
viewPropertyAnimator.start();
}
use of android.animation.ArgbEvaluator in project animate by hitherejoe.
the class ForegroundFrame method animateForegroundColor.
private void animateForegroundColor(@ColorInt final int targetColor) {
ObjectAnimator animator = ObjectAnimator.ofInt(this, FOREGROUND_COLOR, Color.TRANSPARENT, targetColor);
animator.setEvaluator(new ArgbEvaluator());
animator.setStartDelay(DELAY_COLOR_CHANGE);
animator.start();
}
use of android.animation.ArgbEvaluator in project android-app by spark.
the class Pin method getCancelAnimator.
Animator getCancelAnimator() {
ObjectAnimator backToTransparent1 = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_end);
ObjectAnimator goDark = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_go_dark);
ObjectAnimator backToTransparent2 = (ObjectAnimator) AnimatorInflater.loadAnimator(view.getContext(), R.animator.pin_background_end);
ViewGroup parent = (ViewGroup) view.getParent();
ArgbEvaluator evaluator = new ArgbEvaluator();
for (ObjectAnimator animator : list(backToTransparent1, goDark, backToTransparent2)) {
animator.setTarget(parent);
animator.setEvaluator(evaluator);
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setTarget(parent);
animatorSet.playSequentially(backToTransparent1, goDark, backToTransparent2);
return animatorSet;
}
use of android.animation.ArgbEvaluator in project Depth-LIB-Android- by danielzeller.
the class RootActivity method fadeColorTo.
private void fadeColorTo(int newColor, TextView view) {
ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor);
color.setDuration(200);
color.start();
}
use of android.animation.ArgbEvaluator in project Depth-LIB-Android- by danielzeller.
the class ParticleSystem method setColors.
public void setColors(int startColor, int endColor) {
this.startColor = startColor;
this.endColor = endColor;
color = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor, Color.TRANSPARENT).setDuration(DURATION);
}
Aggregations