本文整理汇总了Java中com.nineoldandroids.animation.ObjectAnimator.ofInt方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.ofInt方法的具体用法?Java ObjectAnimator.ofInt怎么用?Java ObjectAnimator.ofInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.ofInt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: slideTo
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void slideTo(int slideOffset, boolean forceInstant) {
if (animator != null) {
animator.cancel();
animator = null;
}
if (!forceInstant) {
animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(400);
animator.start();
ViewCompat.postInvalidateOnAnimation(this);
} else {
this.slideOffset = slideOffset;
requestLayout();
invalidate();
}
}
示例2: initData
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
protected void initData(Context context) {
super.initData(context);
// creating animators
mDimSelectorWheelAnimator = ObjectAnimator.ofFloat(this, PROPERTY_SELECTOR_PAINT_COEFF, 1, 0);
mDimSeparatorsAnimator = ObjectAnimator.ofInt(this, PROPERTY_SEPARATORS_PAINT_ALPHA,
mSelectionDividerActiveAlpha, mSelectionDividerDimmedAlpha
);
// creating paints
mSeparatorsPaint = new Paint();
mSeparatorsPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mSeparatorsPaint.setAlpha(mSelectionDividerDimmedAlpha);
mSelectorWheelPaint = new Paint();
mSelectorWheelPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
}
示例3: startErrorScrollingAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startErrorScrollingAnimator() {
int textWidth = Math.round(textPaint.measureText(error.toString()));
if (errorLabelAnimator == null) {
errorLabelAnimator = ObjectAnimator.ofInt(this, "errorLabelPosX", 0, (textWidth + getWidth() / 2));
errorLabelAnimator.setStartDelay(1000);
errorLabelAnimator.setInterpolator(new LinearInterpolator());
errorLabelAnimator.setDuration(150 * error.length());
errorLabelAnimator.addUpdateListener(this);
errorLabelAnimator.setRepeatCount(ValueAnimator.INFINITE);
} else {
errorLabelAnimator.setIntValues(0, textWidth + getWidth() / 2);
}
errorLabelAnimator.start();
}
示例4: startErrorScrollingAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startErrorScrollingAnimator() {
int textWidth = Math.round(textPaint.measureText(error.toString()));
if (errorLabelAnimator == null) {
errorLabelAnimator = ObjectAnimator.ofInt(this, "errorLabelPosX", 0, textWidth + getWidth() / 2);
errorLabelAnimator.setStartDelay(1000);
errorLabelAnimator.setInterpolator(new LinearInterpolator());
errorLabelAnimator.setDuration(150 * error.length());
errorLabelAnimator.addUpdateListener(this);
errorLabelAnimator.setRepeatCount(ValueAnimator.INFINITE);
} else {
errorLabelAnimator.setIntValues(0, textWidth + getWidth() / 2);
}
errorLabelAnimator.start();
}
示例5: runEnterAnimation
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* The enter animation scales the picture in from its previous thumbnail
* size/location, colorizing it in parallel. In parallel, the background of the
* activity is fading in. When the pictue is in place, the text description
* drops down.
*/
private void runEnterAnimation() {
final long duration = ANIM_DURATION;
// Set starting values for properties we're going to animate. These
// values scale and position the full size version down to the thumbnail
// size/location, from which we'll animate it back up
ViewHelper.setPivotX(mViewPager, 0);
ViewHelper.setPivotY(mViewPager, 0);
ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager, thumbnailLeft);
ViewHelper.setTranslationY(mViewPager, thumbnailTop);
// Animate scale and translation to go from thumbnail to full size
ViewPropertyAnimator.animate(mViewPager)
.setDuration(duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
// Fade in the black background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image from grayscale to full color.
// This happens in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
}
示例6: backgroundColor
import com.nineoldandroids.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;
}
示例7: textColor
import com.nineoldandroids.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;
}
示例8: backgroundColor
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
public AnimationBuilder backgroundColor(int... colors) {
for (View view : this.views) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "backgroundColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
return this;
}
示例9: textColor
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
public AnimationBuilder textColor(int... colors) {
for (View view : this.views) {
if (view instanceof TextView) {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "textColor", colors);
objectAnimator.setEvaluator(new ArgbEvaluator());
this.animatorList.add(objectAnimator);
}
}
return this;
}
示例10: runEnterAnimation
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* The enter animation scales the picture in from its previous thumbnail
* size/location, colorizing it in parallel. In parallel, the background of the
* activity is fading in. When the pictue is in place, the text description
* drops down.
*/
private void runEnterAnimation() {
final long duration = ANIM_DURATION;
// Set starting values for properties we're going to animate. These
// values scale and position the full size version down to the thumbnail
// size/location, from which we'll animate it back up
ViewHelper.setPivotX(mViewPager, 0);
ViewHelper.setPivotY(mViewPager, 0);
ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager, thumbnailLeft);
ViewHelper.setTranslationY(mViewPager, thumbnailTop);
// Animate scale and translation to go from thumbnail to full size
ViewPropertyAnimator.animate(mViewPager)
.setDuration(duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
// Fade in the black background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image from grayscale to full color.
// This happens in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
}
示例11: reset
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void reset() {
if (mObjectAnimator != null && mObjectAnimator.isRunning()) {
return;
}
mObjectAnimator = ObjectAnimator.ofInt(this, "t", (int) -mDetalY / 5, 0);
mObjectAnimator.setDuration(150);
mObjectAnimator.start();
}
示例12: color
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@NonNull
public Animator color(int from, int to, float duration, @Nullable Interpolator interpolator, boolean isText) {
ObjectAnimator animator;
if (mView instanceof TextView && isText) {
TextView tv = (TextView) mView;
tv.setTextColor(from);
animator = ObjectAnimator.ofInt(mView, "textColor", from, to);
} else {
mView.setBackgroundColor(from);
animator = ObjectAnimator.ofInt(mView, "backgroundColor", from, to);
}
setProperties(animator, duration, interpolator);
animator.setEvaluator(new ArgbEvaluator());
return animator;
}