本文整理汇总了Java中android.animation.ValueAnimator.cancel方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.cancel方法的具体用法?Java ValueAnimator.cancel怎么用?Java ValueAnimator.cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ValueAnimator
的用法示例。
在下文中一共展示了ValueAnimator.cancel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decelerate
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void decelerate() {
if (mAccelerateAnimator != null && mAccelerateAnimator.isRunning()) {
mAccelerateAnimator.cancel();
}
if (mFlushRate == FLUSH_RATE) return;
ValueAnimator animator = getDecelerateAnimator();
if (animator.isRunning()) animator.cancel();
long duration = (long) (((float) FLUSH_RATE - mFlushRate) / FLUSH_RATE * 1000);
if (duration == 0) {
mFlushRate = FLUSH_RATE;
return;
}
animator.setDuration(duration);
animator.setFloatValues(mFlushRate, FLUSH_RATE);
animator.start();
}
示例2: stop
import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
* Call this to explicitly stop opacity animation specified by {@code mType}.
*/
public void stop() {
ValueAnimator animator;
if (mOpacityValueAnimatorList != null) {
for (int i = 0; i < mOpacityValueAnimatorList.size(); ++i) {
animator = mOpacityValueAnimatorList.get(i);
if (animator != null) {
animator.cancel();
}
}
mOpacityValueAnimatorList.clear();
}
if (mRippleEffectAnimator != null) {
mRippleEffectAnimator.cancel();
mRippleEffectAnimator = null;
}
}
示例3: onAnimationUpdate
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onAnimationUpdate(ValueAnimator animation) {
//移动图像并给出结果
boolean result = scrollBy(mVector[0], mVector[1]);
//衰减速度
mVector[0] *= FLING_DAMPING_FACTOR;
mVector[1] *= FLING_DAMPING_FACTOR;
//速度太小或者不能移动了就结束
if (!result || MathUtils.getDistance(0, 0, mVector[0], mVector[1]) < 1f) {
animation.cancel();
}
}
示例4: clearValueAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static void clearValueAnimator(ValueAnimator animator) {
if (animator != null) {
animator.removeAllListeners();
animator.removeAllUpdateListeners();
if (Build.VERSION.SDK_INT >= 19) {
animator.pause();
}
animator.cancel();
}
}
示例5: accelerate
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void accelerate() {
if (mFlushRate == FLUSH_RATE_LIMITATION) return;
mFlushRate = FLUSH_RATE; // reset flush rate
ValueAnimator animator = getAccelerateAnimator();
if (animator.isRunning()) animator.cancel();
animator.setFloatValues(mFlushRate, FLUSH_RATE_LIMITATION);
animator.start();
}
示例6: startValueAnimator
import android.animation.ValueAnimator; //导入方法依赖的package包/类
protected ValueAnimator startValueAnimator(ValueAnimator valueAnimator, float targetValue) {
float originValue = targetValue;
if (valueAnimator != null) {
valueAnimator.cancel();
originValue = (float) valueAnimator.getAnimatedValue();
}
valueAnimator = ValueAnimator.ofFloat(originValue, targetValue);
valueAnimator.setDuration(200);
valueAnimator.start();
return valueAnimator;
}
示例7: onAnimationUpdate
import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onAnimationUpdate(final ValueAnimator valueAnimator) {
// If the user is changing the slider, cancel the animation.
if (mIsTracking) {
valueAnimator.cancel();
return;
}
final int animatedIntValue = (int) valueAnimator.getAnimatedValue();
setProgress(animatedIntValue);
}
示例8: cancelAnimation
import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void cancelAnimation() {
if (isInEditMode()) return;
if (animators != null) {
for (ValueAnimator valueAnimator : animators) {
valueAnimator.cancel();
}
animators.clear();
animators = null;
}
}
示例9: clear
import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void clear(){
for (ValueAnimator animator : animators) {
animator.cancel();
}
animators.clear();
}