本文整理汇总了Java中android.animation.ValueAnimator.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.setInterpolator方法的具体用法?Java ValueAnimator.setInterpolator怎么用?Java ValueAnimator.setInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.setInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
super.endAnimation(dynamicWeatherView, listener);
ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.25f, getWidth());
animator.setDuration(1000);
animator.setRepeatCount(0);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
transFactor = (float) animation.getAnimatedValue();
}
});
if (listener != null) {
animator.addListener(listener);
}
animator.start();
}
示例2: endAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
super.endAnimation(dynamicWeatherView, listener);
ValueAnimator animator1 = ValueAnimator.ofFloat(1, 0);
animator1.setInterpolator(new AccelerateInterpolator());
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
speed = (float) animation.getAnimatedValue() * 32;
rotate = (float) animation.getAnimatedValue();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.play(animator1);
animSet.setDuration(1000);
if (listener != null) {
animSet.addListener(listener);
}
animSet.start();
}
示例3: start
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void start() {
if (!isEnableAnim) { // 禁止动画
setText(mPrefixString + format(new BigDecimal(mNumEnd)) + mPostfixString);
return;
}
ValueAnimator animator = ValueAnimator.ofObject(new BigDecimalEvaluator(), new BigDecimal(mNumStart), new BigDecimal(mNumEnd));
animator.setDuration(mDuration);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
BigDecimal value = (BigDecimal) valueAnimator.getAnimatedValue();
setText(mPrefixString + format(value) + mPostfixString);
}
});
animator.start();
}
示例4: onFling
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (mBoundWidth * scale > getWidth()) {
float sx = translateLeft + (1f / 2f) * velocityX * 0.5f * 0.5f;
sx = getExplicitTranslateLeft(sx);
ValueAnimator mResetXAnimator = getResetXAnimator();
mResetXAnimator.setDuration(300);
mResetXAnimator.setInterpolator(mDecInterpolator);
mResetXAnimator.setFloatValues(translateLeft, sx);
mResetXAnimator.addUpdateListener(getOnTranslateXAnimationUpdate());
mResetXAnimator.start();
}
if (mBoundHeight * scale > getHeight()) {
float sy = translateTop + (1f / 2f) * velocityY * 0.5f * 0.5f;
sy = getExplicitTranslateTop(sy);
ValueAnimator mResetYAnimator = getResetYAnimator();
mResetYAnimator.setDuration(300);
mResetYAnimator.setInterpolator(mDecInterpolator);
mResetYAnimator.setFloatValues(translateTop, sy);
mResetYAnimator.addUpdateListener(getOnTranslateYAnimationUpdate());
mResetYAnimator.start();
}
return true;
}
示例5: startAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
super.startAnimation(dynamicWeatherView, fromColor);
ValueAnimator animator1 = ValueAnimator.ofFloat(0, 1);
animator1.setInterpolator(new OvershootInterpolator());
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
speed = (float) animation.getAnimatedValue() * 32;
rotate = (float) animation.getAnimatedValue();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.play(animator1);
animSet.setDuration(1000);
animSet.start();
}
示例6: runButtonAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void runButtonAnimation(){
next.setScaleX(0);next.setScaleY(0);
prev.setScaleX(0);prev.setScaleY(0);
Path arcPath=createArcPath(playPause,0,0,-playPause.getTranslationY());
ValueAnimator pathAnimator=ValueAnimator.ofFloat(0,1);
pathAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
private float point[] = new float[2];
private PathMeasure pathMeasure = new PathMeasure(arcPath, false);
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final float value = animation.getAnimatedFraction();
// Gets the point at the fractional path length
pathMeasure.getPosTan(pathMeasure.getLength() * value, point, null);
// Sets view location to the above point
playPause.setTranslationX(point[0]);
playPause.setTranslationY(point[1]);
}
});
pathAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
pathAnimator.setDuration(duration(R.integer.path_duration)/2);
pathAnimator.start();
next.animate()
.setDuration(duration(R.integer.scale_duration))
.setStartDelay(duration(R.integer.short_delay))
.scaleX(1).scaleY(1)
.start();
prev.animate()
.setDuration(duration(R.integer.scale_duration))
.setStartDelay(duration(R.integer.short_delay))
.scaleX(1).scaleY(1)
.start();
}
示例7: createCosinusValueAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static ValueAnimator createCosinusValueAnimator(final float start, final float end, final CosinusAnimatorUpdateListener listener) {
ValueAnimator valueAnimator = ValueAnimator.ofFloat((float) (-Math.PI), (float) (Math.PI));
valueAnimator.setInterpolator(new LinearInterpolator());
if (listener != null) {
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override public void onAnimationUpdate(ValueAnimator animation) {
double offset = (Math.cos((float) animation.getAnimatedValue()) + 1) / 2;
float value = (float) (start + (end - start) * offset);
listener.onCosinusAnimatorUpdate(value);
}
});
}
return valueAnimator;
}
示例8: startAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void startAnimation() {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, zhuValue);
valueAnimator.setInterpolator(new BounceInterpolator());
valueAnimator.setDuration(2000);
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
zValue = (Float) animation.getAnimatedValue();
postInvalidate();
}
});
valueAnimator.start();
}
示例9: flipAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private static ValueAnimator flipAnimator(boolean isFlipped, final View v) {
ValueAnimator animator = ValueAnimator.ofFloat(isFlipped ? -1f : 1f, isFlipped ? 1f : -1f);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
//Update Height
v.setScaleY((Float) valueAnimator.getAnimatedValue());
}
});
return animator;
}
示例10: startHideAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startHideAnimation() {
//Start the Handler to clean up the Alert
if (!enableInfiniteDuration) {
runningAnimation = new Runnable() {
@Override
public void run() {
hide();
}
};
postDelayed(runningAnimation, duration);
}
if (enableProgress && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
pbProgress.setVisibility(View.VISIBLE);
final ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100);
valueAnimator.setDuration(getDuration());
valueAnimator.setInterpolator(new LinearInterpolator());
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(final ValueAnimator animation) {
getProgressBar().setProgress((int) animation.getAnimatedValue());
}
});
valueAnimator.start();
}
}
示例11: initAnimatior
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private ValueAnimator initAnimatior(final ProgressBean pb) {
Interpolator pathInterpolatorCompat = PathInterpolatorCompat.create(0.7f, 0f, 0.3f, 1f);
ValueAnimator mAnimator = ValueAnimator.ofInt(0, 359);
mAnimator.setDuration(pb.getDuration());
mAnimator.setInterpolator(pathInterpolatorCompat);
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Log.d("dur", animation.getAnimatedValue() + "====" + pb.getmBallRadius());
pb.setmCurrentAngle((int) animation.getAnimatedValue());
invalidate();
}
});
return mAnimator;
}
示例12: hide
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void hide() {
ValueAnimator animator = ValueAnimator.ofFloat(mBottomView.getY(), mOriginalY + mBottomView.getHeight());
animator.setDuration(getDuration());
animator.setInterpolator(getInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mBottomView.setY((Float) valueAnimator.getAnimatedValue());
}
});
animator.start();
}
示例13: onCustomProperty
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@OnClick(R.id.customProperty)
public void onCustomProperty() {
ValueAnimator animator = ObjectAnimator.ofFloat(fancyIcon, "translationXY", fancyIcon.getTranslationXY(), animateForward ? -fancyIcon.getWidth() * 2 : 0.0f);
animator.setDuration(FULL_ANIMATION_DURATION);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.start();
animateForward = !animateForward;
}
示例14: createAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
* 创建回弹动画
* 上圆半径减速恢复至最大半径
* 下圆半径减速恢复至最大半径
* 圆心距减速从最大值减到0(下圆Y从当前位置移动到上圆Y)。
*/
public Animator createAnimator() {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(1, 0.001f).setDuration(BACK_ANIM_DURATION);
valueAnimator.setInterpolator(new DecelerateInterpolator());
valueAnimator.addUpdateListener(valueAnimator1 -> {
updateComleteState((float) valueAnimator1.getAnimatedValue());
postInvalidate();
});
return valueAnimator;
}
示例15: startAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
super.startAnimation(dynamicWeatherView, fromColor);
this.dynamicWeatherView = dynamicWeatherView;
ValueAnimator animator = ValueAnimator.ofFloat(-bitmap.getWidth() * 0.2f, getWidth() - bitmap.getWidth() * 0.2f);
animator.setDuration(1000);
animator.setRepeatCount(0);
animator.setInterpolator(new OvershootInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
transFactor = (float) animation.getAnimatedValue();
}
});
animator.start();
flashRunnable = new Runnable() {
@Override
public void run() {
ValueAnimator animator2 = ValueAnimator.ofFloat(0, 1);
animator2.setDuration(500);
animator2.setRepeatCount(0);
animator2.setInterpolator(new DecelerateInterpolator());
animator2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mAnimatorValue = (float) animation.getAnimatedValue();
}
});
animator2.start();
dynamicWeatherView.postDelayed(flashRunnable, 5000);
}
};
dynamicWeatherView.post(flashRunnable);
}