本文整理了Java中android.animation.ObjectAnimator.ofInt()
方法的一些代码示例,展示了ObjectAnimator.ofInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.ofInt()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:ofInt
暂无
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view,
TransitionValues startValues, TransitionValues endValues) {
if (view == null || view.getBackground() == null) return null;
return ObjectAnimator.ofInt(view.getBackground(), ViewUtils.DRAWABLE_ALPHA, 0);
}
}
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
TransitionValues startValues, TransitionValues endValues) {
if (view == null || view.getBackground() == null) return null;
Drawable background = view.getBackground();
background.setAlpha(0);
return ObjectAnimator.ofInt(background, ViewUtils.DRAWABLE_ALPHA, 0, 255);
}
代码示例来源:origin: wangdan/AisenWeiBo
public void doEndAnim() {
mAnimator = ObjectAnimator.ofInt(this, "InnViewPositionX", mInnViewPositionX, mInnCenterPositionX);
mAnimator.setDuration(250);
mAnimator.start();
}
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static <T> ObjectAnimator ofInt(@Nullable T target,
@NonNull Property<T, Integer> xProperty,
@NonNull Property<T, Integer> yProperty,
@NonNull Path path) {
return ObjectAnimator.ofInt(target, xProperty, yProperty, path);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
public void showLeft() {
translateWidgets(leftWidth, left, middle, right);
ObjectAnimator.ofInt(this, "middleWidth", leftWidth,
middleWidthNormal).setDuration(ANIM_DURATION)
.start();
}
代码示例来源:origin: arcadefire/nice-spinner
private void animateArrow(boolean shouldRotateUp) {
int start = shouldRotateUp ? 0 : MAX_LEVEL;
int end = shouldRotateUp ? MAX_LEVEL : 0;
arrowAnimator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
arrowAnimator.setInterpolator(new LinearOutSlowInInterpolator());
arrowAnimator.start();
}
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator createAnimator(ViewGroup sceneRoot,
TransitionValues startValues,
TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null
|| !(endValues.view instanceof ParallaxScrimageView)) return changeBounds;
ParallaxScrimageView psv = ((ParallaxScrimageView) endValues.view);
if (psv.getOffset() == 0) return changeBounds;
Animator deparallax = ObjectAnimator.ofInt(psv, ParallaxScrimageView.OFFSET, 0);
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, deparallax);
return transition;
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
word=findViewById(R.id.word);
ValueAnimator
positionAnim = ObjectAnimator.ofInt(this, "wordPosition", 0, 25);
positionAnim.setDuration(12500);
positionAnim.setRepeatCount(ValueAnimator.INFINITE);
positionAnim.setRepeatMode(ValueAnimator.RESTART);
positionAnim.start();
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static <T> ObjectAnimator ofArgb(@Nullable T target,
@NonNull Property<T, Integer> property, int... values) {
ObjectAnimator animator = ObjectAnimator.ofInt(target, property, values);
animator.setEvaluator(new ArgbEvaluator());
return animator;
}
代码示例来源:origin: k9mail/k-9
public void setLoadingProgress(int progress, int max) {
if (!isShowingProgress) {
viewAnimator.setDisplayedChild(1);
isShowingProgress = true;
return;
}
int newPosition = (int) (progress / (float) max * PROGRESS_MAX_WITH_MARGIN);
int currentPosition = progressBar.getProgress();
if (newPosition > currentPosition) {
ObjectAnimator.ofInt(progressBar, "progress", currentPosition, newPosition)
.setDuration(PROGRESS_STEP_DURATION).start();
} else {
progressBar.setProgress(newPosition);
}
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@NonNull
public static ObjectAnimator ofArgb(@Nullable Object target, @NonNull String propertyName,
int... values) {
ObjectAnimator animator = ObjectAnimator.ofInt(target, propertyName, values);
animator.setEvaluator(new ArgbEvaluator());
return animator;
}
代码示例来源:origin: frogermcs/InstaMaterial
public void startFromLocation(int[] tapLocationOnScreen) {
changeState(STATE_FILL_STARTED);
startLocationX = tapLocationOnScreen[0];
startLocationY = tapLocationOnScreen[1];
revealAnimator = ObjectAnimator.ofInt(this, "currentRadius", 0, getWidth() + getHeight()).setDuration(FILL_TIME);
revealAnimator.setInterpolator(INTERPOLATOR);
revealAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
changeState(STATE_FINISHED);
}
});
revealAnimator.start();
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
@Nullable
public ObjectAnimator ofInt(@Nullable View view, @NonNull Property<View, Integer> property,
float startFraction, float endFraction) {
int start = (int) (property.get(view) * startFraction);
int end = (int) (property.get(view) * endFraction);
if (start == end) {
return null;
}
property.set(view, start);
return ObjectAnimator.ofInt(view, property, end);
}
}
代码示例来源:origin: florent37/ViewAnimator
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;
}
代码示例来源:origin: florent37/ViewAnimator
public AnimationBuilder textColor(int... colors) {
for (View view : views) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(textView, "textColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
}
return this;
}
代码示例来源:origin: hitherejoe/animate
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();
}
代码示例来源:origin: commonsguy/cw-omnibus
public void hideLeft() {
if (leftWidth == -1) {
leftWidth=left.getWidth();
middleWidthNormal=middle.getWidth();
resetWidget(left, leftWidth);
resetWidget(middle, middleWidthNormal);
resetWidget(right, middleWidthNormal);
requestLayout();
}
translateWidgets(-1 * leftWidth, left, middle, right);
ObjectAnimator.ofInt(this, "middleWidth", middleWidthNormal,
leftWidth).setDuration(ANIM_DURATION).start();
}
代码示例来源:origin: florent37/ExpectAnim
@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;
}
}
}
代码示例来源:origin: tarek360/RichPath
private AnimationBuilder color(String propertyName, int... colors) {
for (final RichPath path : paths) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(path, propertyName, colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
applyAnimatorProperties(objectAnimator, path);
}
return this;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void start_shouldRunAnimation() {
final ObjectAnimator animator = ObjectAnimator.ofInt(target, "transparency", 0, 1, 2, 3, 4);
Robolectric.getForegroundThreadScheduler().pause();
animator.setDuration(1000);
animator.addListener(listener);
animator.start();
assertThat(listenerEvents).containsExactly("started");
assertThat(target.getTransparency()).isEqualTo(0);
Robolectric.flushForegroundThreadScheduler();
assertThat(listenerEvents).containsExactly("started", "ended");
assertThat(target.getTransparency()).isEqualTo(4);
}
内容来源于网络,如有侵权,请联系作者删除!