android.view.animation.ScaleAnimation#setRepeatCount()源码实例Demo

下面列出了android.view.animation.ScaleAnimation#setRepeatCount() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Android-Basics-Codes   文件: MainActivity.java
/**
 * ���Ŷ���
 * 
 * @param v
 */
public void scale(View v) {

	/*
	 * ����1��x������ʼ��С(1f��ʾԭͼ��С) ����2��x������ֹ��С(0.2f��ʾԭͼ��0.2��)
	 * ����3��y������ʼ��С(1f��ʾԭͼ��С) ����4��y������ֹ��С(0.2f��ʾԭͼ��0.2��) ����5���������ĵ�x��ȡֵ�IJ��շ�ʽ
	 * ����6: ���ĵ�x���ȡֵ(0.5f��ʾ�����ԭͼ��0.5��) ����7���������ĵ�y��ȡֵ���շ�ʽ ����8:
	 * ���ĵ�y���ȡֵ(0.5f��ʾ�����ԭͼ��0.5��)
	 */
	ScaleAnimation rotate = new ScaleAnimation(4f, 0.2f, 4f, 0.2f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	rotate.setDuration(2000);
	// �����ظ�����
	rotate.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	rotate.setRepeatMode(Animation.REVERSE);

	// ��ImageView�ϲ��Ŷ���
	iv.startAnimation(rotate);
}
 
源代码2 项目: RippleImageView   文件: RippleImageView.java
/**
 * 初始化动画集
 * @return
 */
private AnimationSet initAnimationSet() {
    AnimationSet as = new AnimationSet(true);
    //缩放度:变大两倍
    ScaleAnimation sa = new ScaleAnimation(1f, 2f, 1f, 2f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    sa.setDuration(show_spacing_time * 3);
    sa.setRepeatCount(Animation.INFINITE);// 设置循环
    //透明度
    AlphaAnimation aa = new AlphaAnimation(1, 0.1f);
    aa.setDuration(show_spacing_time * 3);
    aa.setRepeatCount(Animation.INFINITE);//设置循环
    as.addAnimation(sa);
    as.addAnimation(aa);
    return as;
}
 
/**
 * 中间的View动画播放
 */
private void playCenter() {
    AnimationSet animationSet = new AnimationSet(false);
    ScaleAnimation scaleSmall = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    ScaleAnimation scaleBig = new ScaleAnimation(1.0f, 5.0f/3, 1.0f, 5.0f/3,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleBig.setDuration(2*1000);
    scaleBig.setInterpolator(interpolator);
    scaleSmall.setDuration(2*1000);
    scaleSmall.setStartOffset(2*1000);
    scaleSmall.setRepeatCount(-1);
    scaleSmall.setFillEnabled(true);
    scaleSmall.setFillAfter(true);
    scaleBig.setStartOffset(2*1000);
    scaleBig.setRepeatCount(-1);
    scaleBig.setFillEnabled(true);
    scaleBig.setFillAfter(true);
    scaleSmall.setInterpolator(interpolator);
    animationSet.addAnimation(scaleBig);
    animationSet.addAnimation(scaleSmall);
    center.startAnimation(animationSet);
}
 
源代码4 项目: a   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码5 项目: timecat   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码6 项目: CatchPiggy   文件: ClassicMode.java
/**
 格子触摸时的动画
 */
public Animation getItemTouchAnimation() {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1, .7F, 1, .7F, Animation.RELATIVE_TO_SELF, .5F, Animation.RELATIVE_TO_SELF, .5F);
    scaleAnimation.setDuration(130);
    scaleAnimation.setRepeatCount(1);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    return scaleAnimation;
}
 
源代码7 项目: stynico   文件: bilibili.java
@Override
   protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
       super.onSizeChanged(w, h, oldw, oldh);
       WIDTH = w;
       HEIGHT = h;

       scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
       scaleAnimation.setDuration(zoomDuration);
       scaleAnimation.setRepeatMode(Animation.REVERSE);
       scaleAnimation.setRepeatCount(1);
   }
 
源代码8 项目: UltimateAndroid   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码9 项目: AssistantBySDK   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码10 项目: iGap-Android   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
private Animation getScaleAnimation() {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 2f,
            1f, 2f,
            getWidth() / 2, getHeight() / 2);
    scaleAnimation.setDuration(2000);
    scaleAnimation.setRepeatCount(2);
    scaleAnimation.setFillAfter(true);
    scaleAnimation.setFillBefore(false);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    return scaleAnimation;
}
 
源代码12 项目: BaseProject   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码13 项目: DoubanTop   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码14 项目: ZDepthShadow   文件: RippleView.java
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
    super.onSizeChanged(w, h, oldw, oldh);
    WIDTH = w;
    HEIGHT = h;

    scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2);
    scaleAnimation.setDuration(zoomDuration);
    scaleAnimation.setRepeatMode(Animation.REVERSE);
    scaleAnimation.setRepeatCount(1);
}
 
源代码15 项目: android-draggable-viewpager   文件: DragDropGrid.java
private void animateOnTheEdge() {
    if (!adapter.disableZoomAnimationsOnChangePage()) {
        View v = getDraggedView();

        ScaleAnimation scale = new ScaleAnimation(.667f, 1.5f, .667f, 1.5f, v.getMeasuredWidth() * 3 / 4, v.getMeasuredHeight() * 3 / 4);
        scale.setDuration(200);
        scale.setRepeatMode(Animation.REVERSE);
        scale.setRepeatCount(Animation.INFINITE);

        v.clearAnimation();
        v.startAnimation(scale);
    }
}
 
源代码16 项目: actor-platform   文件: ViewUtils.java
public static void wave(final View layer, float scale, int duration, float stepOffset) {
    final ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, scale, 1.0f, scale, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
    scaleAnimation.setDuration(duration);

    scaleAnimation.setInterpolator(new OffsetCycleInterpolator(stepOffset));
    scaleAnimation.setRepeatCount(Animation.INFINITE);
    layer.clearAnimation();
    layer.startAnimation(scaleAnimation);
}
 
源代码17 项目: AndroidWearable-Samples   文件: MainActivity.java
/**
 * Animates the layout when clicked. The animation used depends on whether the
 * device is round or rectangular.
 */
public void onLayoutClicked(View view) {
    if (mRectBackground != null) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.7f, 1.0f, 0.7f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(300);
        scaleAnimation.setRepeatCount(1);
        scaleAnimation.setRepeatMode(Animation.REVERSE);
        mRectBackground.startAnimation(scaleAnimation);
    }
    if (mRoundBackground != null) {
        mRoundBackground.animate().rotationBy(360).setDuration(300).start();
    }
}
 
源代码18 项目: Android-Basics-Codes   文件: MainActivity.java
/**
 * ���Ŷ���
 * 
 * @param v
 */
public void scale(View v) {

	/*
	 * ����1��x������ʼ��С(1f��ʾԭͼ��С) 
	 * ����2��x������ֹ��С(0.2f��ʾԭͼ��0.2��)
	 * ����3��y������ʼ��С(1f��ʾԭͼ��С) 
	 * ����4��y������ֹ��С(0.2f��ʾԭͼ��0.2��) 
	 * ����5���������ĵ�x��ȡֵ�IJ��շ�ʽ
	 * ����6: ���ĵ�x���ȡֵ(0.5f��ʾ�����ԭͼ��0.5��) 
	 * ����7���������ĵ�y��ȡֵ���շ�ʽ
	 *  ����8:���ĵ�y���ȡֵ(0.5f��ʾ�����ԭͼ��0.5��)
	 */
	ScaleAnimation rotate = new ScaleAnimation(4f, 0.2f, 4f, 0.2f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	rotate.setDuration(2000);
	// �����ظ�����
	rotate.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	rotate.setRepeatMode(Animation.REVERSE);

	// ��ImageView�ϲ��Ŷ���
	iv.startAnimation(rotate);
}
 
源代码19 项目: android-WatchViewStub   文件: MainActivity.java
/**
 * Animates the layout when clicked. The animation used depends on whether the
 * device is round or rectangular.
 */
public void onLayoutClicked(View view) {
    if (mRectBackground != null) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.7f, 1.0f, 0.7f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(300);
        scaleAnimation.setRepeatCount(1);
        scaleAnimation.setRepeatMode(Animation.REVERSE);
        mRectBackground.startAnimation(scaleAnimation);
    }
    if (mRoundBackground != null) {
        mRoundBackground.animate().rotationBy(360).setDuration(300).start();
    }
}
 
源代码20 项目: Android-Basics-Codes   文件: MainActivity.java
public void mahang (View view){
	AnimationSet set = new AnimationSet(false);
	
	TranslateAnimation tras = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2,
			Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 2);
	// ������ʾʱ�䳤��
	tras.setDuration(2000);
	// �����ظ�����
	tras.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	tras.setRepeatMode(Animation.REVERSE);
	
	RotateAnimation rotate = new RotateAnimation(360, 0,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	rotate.setDuration(2000);
	// �����ظ�����
	rotate.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	rotate.setRepeatMode(Animation.REVERSE);

	
	
	ScaleAnimation scale = new ScaleAnimation(4f, 0.2f, 4f, 0.2f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);

	// ������ʾʱ�䳤��
	scale.setDuration(2000);
	// �����ظ�����
	scale.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	scale.setRepeatMode(Animation.REVERSE);

	
	Animation alpha = new AlphaAnimation(1f, 0.1f);

	// ������ʾʱ�䳤��
	alpha.setDuration(2000);
	// �����ظ�����
	alpha.setRepeatCount(2);
	// ���ö����ظ���ģʽ
	alpha.setRepeatMode(Animation.REVERSE);
	
	set.addAnimation(tras);
	set.addAnimation(alpha);
	set.addAnimation(rotate);
	set.addAnimation(scale);
	
	// ��ImageView�ϲ��Ŷ���
	iv.startAnimation(set);

}