当前位置: 首页>>代码示例>>Java>>正文


Java AnimatorUpdateListener类代码示例

本文整理汇总了Java中com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener的典型用法代码示例。如果您正苦于以下问题:Java AnimatorUpdateListener类的具体用法?Java AnimatorUpdateListener怎么用?Java AnimatorUpdateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnimatorUpdateListener类属于com.nineoldandroids.animation.ValueAnimator包,在下文中一共展示了AnimatorUpdateListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startDiscAnimator

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
private void startDiscAnimator(float animatedValue) {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
    mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
    mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
 
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:20,代码来源:PlayerDiscView.java

示例2: reverseDiscAnimator

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
private void reverseDiscAnimator() {
    mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", mDiscLayoutAnimatorValue, 360);
    mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
        }
    });
    mDiscLayoutAnimator.setDuration(DISC_REVERSE_ANIMATOR_TIME);
    mDiscLayoutAnimator.setInterpolator(new AccelerateInterpolator());

    if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
        mDiscLayoutAnimator.cancel();
    }

    mDiscLayoutAnimator.start();
}
 
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:19,代码来源:PlayerDiscView.java

示例3: performAnimate

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
private void performAnimate(final View target, final int start, final int end) {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(1, 100);
    valueAnimator.addUpdateListener(new AnimatorUpdateListener() {

        // 持有一个IntEvaluator对象,方便下面估值的时候使用
        private IntEvaluator mEvaluator = new IntEvaluator();

        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            // 获得当前动画的进度值,整型,1-100之间
            int currentValue = (Integer) animator.getAnimatedValue();
            Log.d(TAG, "current value: " + currentValue);

            // 获得当前进度占整个动画过程的比例,浮点型,0-1之间
            float fraction = animator.getAnimatedFraction();
            // 直接调用整型估值器通过比例计算出宽度,然后再设给Button
            target.getLayoutParams().width = mEvaluator.evaluate(fraction, start, end);
            target.requestLayout();
        }
    });

    valueAnimator.setDuration(5000).start();
}
 
开发者ID:singwhatiwanna,项目名称:android-art-res,代码行数:24,代码来源:DemoActivity_1.java

示例4: show

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
public FancyProgress2 show(){
	setVisibility(View.VISIBLE);
	mAnim = ValueAnimator.ofFloat(1.0f);
	mAnim.setInterpolator(new LinearInterpolator());
	mAnim.setDuration(2000);
	mAnim.setRepeatCount(ValueAnimator.INFINITE);
	mAnim.addUpdateListener(new AnimatorUpdateListener() {
		
		@Override
		public void onAnimationUpdate(ValueAnimator animation) {
			mPercent = animation.getAnimatedFraction();
			isFront = mPercent < 0.5f;
			invalidate();
		}
	});
	mAnim.start();
	invalidate();
	
	return this;
}
 
开发者ID:PoplarTang,项目名称:FancyProgress,代码行数:21,代码来源:FancyProgress2.java

示例5: onFlagChanged

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
private void onFlagChanged(final CardFlag oldFlag, final CardFlag newFlag) {
	int flagColor = CARD_BACKGROUND_COLOR_NOFLAG;
	if (newFlag != null) {
		flagColor = newFlag.getColor();
	}
	
	ValueAnimator fade = ObjectAnimator.ofInt(mCardPaint,
			"color", mCardPaint.getColor(), flagColor);
	fade.setDuration(500);
	fade.setEvaluator(new ArgbEvaluator());
	fade.addUpdateListener(new AnimatorUpdateListener() {
		@Override
		public void onAnimationUpdate(ValueAnimator value) {
			onFlagChangedUpdate(oldFlag, newFlag, value);
			invalidate();
		}
	});
	
	fade.start();
}
 
开发者ID:julioz,项目名称:CardView,代码行数:21,代码来源:CardFaceView.java

示例6: getWidthAnimator

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:TransferControlView.java

示例7: custom

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
public AnimationBuilder custom(final Update update, float... values) {
    for (final View view : this.views) {
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(getValues(values));
        if (update != null) {
            valueAnimator.addUpdateListener(new AnimatorUpdateListener() {
                public void onAnimationUpdate(ValueAnimator animation) {
                    update.update(view, ((Float) animation.getAnimatedValue()).floatValue());
                }
            });
        }
        add(valueAnimator);
    }
    return this;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:AnimationBuilder.java

示例8: setProgress

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
/**
     * 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步 刷新界面调用postInvalidate()能在非UI线程刷新
     *
     * @param progress
     */

    public synchronized void setProgress(int progress) {
        if (this.progress == progress) {
            return;
        }

//        hasShowing = true;
        if (progress < 0) {
//			throw new IllegalArgumentException("progress not less than 0");
            return;
        }
        if (progress > max) {
            progress = max;
        }
        ValueAnimator va = ValueAnimator.ofInt(this.progress, progress);
        va.setDuration(1000);
        va.setInterpolator(new AccelerateInterpolator());
        va.start();
        va.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator arg0) {
                int value = (Integer) arg0.getAnimatedValue();
                if (value <= max) {
                    RoundProgressBar.this.progress = value;
                    invalidate();
                }
            }
        });

    }
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:36,代码来源:RoundProgressBar.java

示例9: FlakeView

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
/**
 * Constructor. Create objects used throughout the life of the View: the Paint and
 * the animator
 */
public FlakeView(Context context) {
    super(context);
    droid = BitmapFactory.decodeResource(getResources(), R.drawable.droid);
    textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    textPaint.setColor(Color.WHITE);
    textPaint.setTextSize(24);

    // This listener is where the action is for the flak animations. Every frame of the
    // animation, we calculate the elapsed time and update every flake's position and rotation
    // according to its speed.
    animator.addUpdateListener(new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator arg0) {
            long nowTime = System.currentTimeMillis();
            float secs = (float)(nowTime - prevTime) / 1000f;
            prevTime = nowTime;
            for (int i = 0; i < numFlakes; ++i) {
                Flake flake = flakes.get(i);
                flake.y += (flake.speed * secs);
                if (flake.y > getHeight()) {
                    // If a flake falls off the bottom, send it back to the top
                    flake.y = 0 - flake.height;
                }
                flake.rotation = flake.rotation + (flake.rotationSpeed * secs);
            }
            // Force a redraw to see the flakes in their new positions and orientations
            invalidate();
        }
    });
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setDuration(3000);
}
 
开发者ID:515445681,项目名称:NineOldAndroids-master,代码行数:37,代码来源:FlakeView.java

示例10: show

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
public void show(){
	mAnim = ValueAnimator.ofFloat(1.0f);
	mAnim.addUpdateListener(new AnimatorUpdateListener() {
		
		@Override
		public void onAnimationUpdate(ValueAnimator animation) {
			mPercent = animation.getAnimatedFraction();
			invalidate();
		}
	});
	mAnim.setInterpolator(new LinearInterpolator());
	mAnim.setRepeatCount(ValueAnimator.INFINITE);
	mAnim.setDuration(mOneShotDuration * 4);
	mAnim.start();
}
 
开发者ID:PoplarTang,项目名称:FancyProgress,代码行数:16,代码来源:FancyProgress4.java

示例11: FlakeView

import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; //导入依赖的package包/类
/**
	 * Constructor. Create objects used throughout the life of the View: the
	 * Paint and the animator
	 */
	public FlakeView(Context context) {
		super(context);
		droid = BitmapFactory.decodeResource(getResources(),
				R.drawable.white_snow);
		snowImg = BitmapFactory.decodeResource(getResources(),
				R.drawable.white_snow);
		daoFlowerImg1 = BitmapFactory.decodeResource(getResources(),
				R.drawable.flower1);
		daoFlowerImg2 = BitmapFactory.decodeResource(getResources(),
				R.drawable.flower2);
//		daoFlowerImg3 = BitmapFactory.decodeResource(getResources(),
//				R.drawable.flower3);
//		heartImg = BitmapFactory.decodeResource(getResources(),
//				R.drawable.heart);

		textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
		textPaint.setColor(Color.WHITE);
		textPaint.setTextSize(24);

		// This listener is where the action is for the flak animations. Every
		// frame of the
		// animation, we calculate the elapsed time and update every flake's
		// position and rotation
		// according to its speed.
		animator.addUpdateListener(new AnimatorUpdateListener() {
			@Override
			public void onAnimationUpdate(ValueAnimator arg0) {
				long nowTime = System.currentTimeMillis();
				float secs = (float) (nowTime - prevTime) / 1000f;
				prevTime = nowTime;
				for (int i = 0; i < numFlakes; ++i) {
					Flake flake = flakes.get(i);
					flake.y += (flake.speed * secs);
					if (flake.y > getHeight()) {
						// If a flake falls off the bottom, send it back to the
						// top
						flake.y = 0 - flake.height;
					}
					flake.rotation = flake.rotation
							+ (flake.rotationSpeed * secs);
				}
				// Force a redraw to see the flakes in their new positions and
				// orientations
				invalidate();
			}
		});
		animator.setRepeatCount(ValueAnimator.INFINITE);
		animator.setDuration(3000);
	}
 
开发者ID:SEA2015-GROUP7,项目名称:projectTetViet,代码行数:54,代码来源:FlakeView.java


注:本文中的com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。