本文整理汇总了Java中android.animation.ObjectAnimator.ofInt方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.ofInt方法的具体用法?Java ObjectAnimator.ofInt怎么用?Java ObjectAnimator.ofInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.ofInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startBackgroundAlphaAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startBackgroundAlphaAnimation(final View bgView, final ColorDrawable colorDrawable, int... value) {
if (bgView == null)
return;
if (value == null || value.length == 0) {
value = new int[]{0, 255};
}
ObjectAnimator animator = ObjectAnimator.ofInt(colorDrawable, "alpha", value);
animator.setDuration(mDuration);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
bgView.setBackground(colorDrawable);
}
});
animator.start();
}
示例2: updateProgress
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void updateProgress() {
if (this.progressAnimator != null && this.progressAnimator.isRunning()) {
this.progressAnimator.end();
}
double progress = (double) (((this.mentionIndex * 1000) + ((this.playCountNum * 1000) /
this.currentMention.number)) / this.totalMetionCount);
this.progressAnimator = ObjectAnimator.ofInt(this.progressBar, "progress", new int[]{
(int) progress});
if (this.currentMention.is_times) {
this.progressAnimator.setDuration(((long) this.currentMention.rate) * 1000);
} else {
this.progressAnimator.setDuration(1000);
}
this.progressAnimator.setInterpolator(new LinearInterpolator());
this.progressAnimator.start();
}
示例3: cancelMergeAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void cancelMergeAnimation(){
if(mStarAnimator != null && mStarAnimator.isRunning()){
mStarAnimator.cancel();
}
if(mCancelAnimator == null) {
mCancelAnimator = ObjectAnimator.ofInt(this, mOutlineProperty, mSavedOutlinePadding);
mCancelAnimator.setDuration(mAnimationDuration);
mCancelAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
inMerge = false;
}
});
}else if(mCancelAnimator.isRunning()){
mCancelAnimator.cancel();
}
mCancelAnimator.start();
}
示例4: startMergeAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void startMergeAnimation() {
if(mCancelAnimator != null&&mCancelAnimator.isRunning()){
mCancelAnimator.cancel();
}
if(mStarAnimator == null) {
mStarAnimator = ObjectAnimator.ofInt(this, mOutlineProperty, 0);
mStarAnimator.setDuration(mAnimationDuration);
mStarAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
inMerge = true;
}
});
}else if(mStarAnimator.isRunning()){
mStarAnimator.cancel();
}
mStarAnimator.start();
}
示例5: initAnimator
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void initAnimator() {
if (mObjectAnimator == null) {
mObjectAnimator = ObjectAnimator.ofInt(3, 6);
mObjectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int value = (int) animation.getAnimatedValue();
if (value != last) {
last = value;
factor = last / 10f;
L.e("call: onAnimationUpdate([animation])-> " + factor);
postInvalidate();
}
}
});
mObjectAnimator.setRepeatCount(ValueAnimator.INFINITE);
mObjectAnimator.setRepeatMode(ValueAnimator.REVERSE);
mObjectAnimator.setDuration(300);
mObjectAnimator.start();
}
}
示例6: runResetAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void runResetAnimation(boolean useCloseAnimationDuration) {
cancelRunningAnimation();
ObjectAnimator swipe = ObjectAnimator.ofFloat(this, View.TRANSLATION_X, 0.f);
ObjectAnimator fadeIn = ObjectAnimator.ofFloat(this, View.ALPHA, 1.f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, View.SCALE_X, 1.f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, View.SCALE_Y, 1.f);
ObjectAnimator resetHeight = ObjectAnimator.ofInt(this, "height", mDefaultHeight);
AnimatorSet set = new AnimatorSet();
set.playTogether(swipe, fadeIn, scaleX, scaleY, resetHeight);
set.setDuration(useCloseAnimationDuration
? mCloseAnimationDurationMs : mDefaultAnimationDurationMs);
set.start();
mActiveAnimation = set;
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:AccessibilityTabModelListItem.java
示例7: close
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void close() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", mLinearLayoutWidth, 0);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
示例8: onOptionsItemSelected
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()){
case R.id.animate:
ObjectAnimator animator = ObjectAnimator.ofInt(mSeekBar, "progress", 0,
mSeekBar.getMax());
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(SEEKBAR_ANIMATION_DURATION);
animator.start();
break;
case R.id.checkbox:
if (mIsChecked) {
item.setChecked(false);
mIsChecked = false;
} else {
item.setChecked(true);
mIsChecked = true;
}
break;
case R.id.builtin_pixelation_checkbox:
mIsBuiltinPixelizationChecked = !mIsBuiltinPixelizationChecked;
item.setChecked(mIsBuiltinPixelizationChecked);
break;
default:
break;
}
return true;
}
示例9: startWaveAnim
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void startWaveAnim() {
if (animator != null)
animator.end();
animator = ObjectAnimator.ofInt(this, "wavePos", 0, 1920);
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(durMillis);
animator.setRepeatMode(ValueAnimator.RESTART);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.start();
}
示例10: setStepProgressBar
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void setStepProgressBar(float fractionRemaining) {
ObjectAnimator animation = ObjectAnimator.ofInt(stepProgressBar, "progress",
Math.round(fractionRemaining * 10000));
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(1000);
animation.start();
}
示例11: spinToIndex
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void spinToIndex(int newIndex) {
int delta = newIndex - currentIndex;
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(this, "scrollY", getScrollY() + delta * itemHeight);
objectAnimator.setDuration(SPIN_ANIMATION_TIME_MILLISEC);
objectAnimator.start();
currentIndex = newIndex;
}
示例12: startRipple
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startRipple(final Runnable animationEndRunnable) {
if (eventCancelled) return;
float endRadius = getEndRadius();
cancelAnimations();
rippleAnimator = new AnimatorSet();
rippleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!ripplePersistent) {
setRadius(0);
setRippleAlpha(rippleAlpha);
}
if (animationEndRunnable != null && rippleDelayClick) {
animationEndRunnable.run();
}
childView.setPressed(false);
}
});
ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
ripple.setDuration(rippleDuration);
ripple.setInterpolator(new DecelerateInterpolator());
ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
fade.setDuration(rippleFadeDuration);
fade.setInterpolator(new AccelerateInterpolator());
fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
if (ripplePersistent) {
rippleAnimator.play(ripple);
} else if (getRadius() > endRadius) {
fade.setStartDelay(0);
rippleAnimator.play(fade);
} else {
rippleAnimator.playTogether(ripple, fade);
}
rippleAnimator.start();
}
示例13: 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++;
}
}
示例14: onUpdateProgressViews
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void onUpdateProgressViews(int progress, int total) {
mProgressBar.setMax(total);
ObjectAnimator animator = ObjectAnimator.ofInt(mProgressBar, "progress", progress);
animator.setDuration(1500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
mTime.setText(MusicUtil.getReadableDurationString(total) +
"/" + MusicUtil.getReadableDurationString(progress));
//songTotalTime.setText(MusicUtil.getReadableDurationString(total));
//songCurrentProgress.setText(MusicUtil.getReadableDurationString(progress));
}
示例15: smoothScrollSeekbar
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Smoothly scrolls the seekbar to the indicated position.
*/
private void smoothScrollSeekbar(int progress) {
ObjectAnimator animation = ObjectAnimator.ofInt(mSeekBar, "progress", progress);
animation.setDuration(200);
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
}