本文整理汇总了Java中android.animation.ObjectAnimator.setEvaluator方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.setEvaluator方法的具体用法?Java ObjectAnimator.setEvaluator怎么用?Java ObjectAnimator.setEvaluator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.setEvaluator方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sunsetAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void sunsetAnimator() {
float sunYStart = mSunView.getTop();
float sunYEnd = mSkyView.getHeight();
ObjectAnimator heightAnimator = ObjectAnimator.ofFloat(mSunView, "y", sunYStart, sunYEnd)
.setDuration(3000);
ObjectAnimator sunsetSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mBlueSkyColor, mSunsetSkyColor)
.setDuration(3000);
ObjectAnimator nightSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mSunsetSkyColor, mNightSkyColor)
.setDuration(1500);
heightAnimator.setInterpolator(new AccelerateInterpolator());
sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());
nightSkyAnimator.setEvaluator(new ArgbEvaluator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(heightAnimator).with(sunsetSkyAnimator).before(nightSkyAnimator);
animatorSet.start();
}
示例2: sunriseAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void sunriseAnimator() {
float sunriseYStart = mSkyView.getHeight();
float sunriseYEnd = mSunView.getTop();
ObjectAnimator heightAnimator = ObjectAnimator.ofFloat(mSunView, "y",
sunriseYStart, sunriseYEnd)
.setDuration(3000);
ObjectAnimator sunriseSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mSunsetSkyColor, mBlueSkyColor)
.setDuration(3000);
ObjectAnimator daySkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
mNightSkyColor, mSunsetSkyColor)
.setDuration(3000);
heightAnimator.setInterpolator(new AccelerateInterpolator());
sunriseSkyAnimator.setEvaluator(new ArgbEvaluator());
daySkyAnimator.setEvaluator(new ArgbEvaluator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(daySkyAnimator).before(sunriseSkyAnimator).before(heightAnimator)
;
animatorSet.start();
}
示例3: setColorTitles
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
void setColorTitles(boolean animated) {
int index = 0;
for (TextView textView : this.textViews) {
int color = index == this.currentIndex ? -1 : backTextColor;
if (getWidth() == 0 || !animated) {
textView.setTextColor(color);
} else {
ObjectAnimator colorAnim = ObjectAnimator.ofInt(textView
, "textColor", textView.getCurrentTextColor(), color);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
}
index++;
}
}
示例4: select
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void select(@Nullable String selectTitle) {
ObjectAnimator colorAnim = ObjectAnimator.ofInt(binding.textViewDialogSelector
, "textColor", binding.textViewDialogSelector.getCurrentTextColor(), ContextCompat.getColor(context, R.color.accentColor));
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
binding.iconImgv.setImageResource(selectedIcon);
binding.textViewDialogSelector.setText(selectTitle);
binding.selectorImgv.setImageResource(R.drawable.ic_previous_selected_p_dialog);
binding.selectorRly.setBackgroundResource(R.drawable.border_radius_20_selected_p_dialog);
isSelected = true;
}
示例5: setError
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void setError() {
ObjectAnimator colorAnim = ObjectAnimator.ofInt(binding.textViewDialogSelector
, "textColor", binding.textViewDialogSelector.getCurrentTextColor(), ContextCompat.getColor(context, R.color.redDialog));
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
binding.iconImgv.setImageResource(imageViewResource);
binding.textViewDialogSelector.setText(textViewInput);
binding.selectorImgv.setImageResource(R.drawable.ic_previous_error_p_dialog);
binding.selectorRly.setBackgroundResource(R.drawable.border_radius_20_error_p_dialog);
isSelected = false;
}
示例6: resetView
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void resetView() {
if (isSelected) {
ObjectAnimator colorAnim = ObjectAnimator.ofInt(binding.textViewDialogSelector
, "textColor", binding.textViewDialogSelector.getCurrentTextColor(), textColor);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.start();
binding.iconImgv.setImageResource(imageViewResource);
binding.textViewDialogSelector.setText(textViewInput);
binding.selectorImgv.setImageResource(R.drawable.ic_previous_normal_p_dialog);
binding.selectorRly.setBackgroundResource(R.drawable.border_radius_20_normal_p_dialog);
idSelector = "";
isSelected = false;
}
}
示例7: createColorAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private static Animator createColorAnimator(Object target, String propertyName, @ColorInt int startColor, @ColorInt int endColor) {
ObjectAnimator animator;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator = ObjectAnimator.ofArgb(target, propertyName, startColor, endColor);
} else {
animator = ObjectAnimator.ofInt(target, propertyName, startColor, endColor);
animator.setEvaluator(new ArgbEvaluator());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
animator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
}
animator.setDuration(PHONOGRAPH_ANIM_TIME);
return animator;
}
示例8: showText
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void showText(TextView textView, String text, int fromColor, int toColor) {
textView.setText(text);
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(textView, "textColor", fromColor, toColor);
objectAnimator.setEvaluator(new ArgbEvaluator());
objectAnimator.setDuration(300);
objectAnimator.setRepeatCount(0);
objectAnimator.start();
}
示例9: getAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public Animator getAnimator(View viewToMove) {
if (viewToMove instanceof TextView) {
final ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewToMove, "textColor", ((TextView) viewToMove).getCurrentTextColor(), textColor);
objectAnimator.setEvaluator(new ArgbEvaluator());
return objectAnimator;
} else {
return null;
}
}
示例10: setupColorAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void setupColorAnimator(Animator animator) {
if (animator instanceof AnimatorSet) {
List<Animator> childAnimators = ((AnimatorSet) animator).getChildAnimations();
if (childAnimators != null) {
for (int i = 0; i < childAnimators.size(); i++) {
setupColorAnimator((Animator) childAnimators.get(i));
}
}
}
if (animator instanceof ObjectAnimator) {
ObjectAnimator objectAnim = (ObjectAnimator) animator;
String propertyName = objectAnim.getPropertyName();
if ("fillColor".equals(propertyName) || "strokeColor".equals(propertyName)) {
if (this.mArgbEvaluator == null) {
this.mArgbEvaluator = new ArgbEvaluator();
}
objectAnim.setEvaluator(this.mArgbEvaluator);
}
}
}
示例11: startAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startAnimation() {
float sunYStart = mSunView.getTop();
float sunYEnd = mSkyView.getHeight();
ObjectAnimator heightAnimator = ObjectAnimator
.ofFloat(mSunView, "y", sunYStart, sunYEnd)
.setDuration(3000);
heightAnimator.setInterpolator(new AccelerateInterpolator());
ObjectAnimator sunsetSkyAnimator = ObjectAnimator
.ofInt(mSkyView, "backgroundColor", mBlueSkyColor, mSunsetSkyColor)
.setDuration(3000);
sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());
ObjectAnimator nightSkyAnimator = ObjectAnimator
.ofInt(mSkyView, "backgroundColor", mSunsetSkyColor, mNightSkyColor)
.setDuration(1500);
nightSkyAnimator.setEvaluator(new ArgbEvaluator());
AnimatorSet animatorSet = new AnimatorSet();
animatorSet
.play(heightAnimator)
.with(sunsetSkyAnimator)
.before(nightSkyAnimator);
animatorSet.start();
}
示例12: backgroundColor
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Background color animation builder.
*
* @param colors the colors
* @return the animation builder
*/
public AnimationBuilder backgroundColor(int... colors) {
for (View view : views) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "backgroundColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
return this;
}
示例13: textColor
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Text color animation builder.
*
* @param colors the colors
* @return the animation builder
*/
public AnimationBuilder textColor(int... colors) {
for (View view : views) {
if (view instanceof TextView) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "textColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
}
return this;
}