Java Code Examples for android.view.animation.ScaleAnimation#setRepeatCount()

The following examples show how to use android.view.animation.ScaleAnimation#setRepeatCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 6 votes vote down vote up
/**
 * ���Ŷ���
 * 
 * @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);
}
 
Example 2
Source File: RippleImageView.java    From RippleImageView with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化动画集
 * @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;
}
 
Example 3
Source File: DynamicRotationGuideView.java    From AndroidStudyDemo with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 中间的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);
}
 
Example 4
Source File: MainActivity.java    From android-WatchViewStub with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 5
Source File: RippleView.java    From a with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 6
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 5 votes vote down vote up
/**
 * ���Ŷ���
 * 
 * @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);
}
 
Example 7
Source File: MainActivity.java    From AndroidWearable-Samples with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 8
Source File: ViewUtils.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: DragDropGrid.java    From android-draggable-viewpager with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 10
Source File: RippleView.java    From ZDepthShadow with MIT License 5 votes vote down vote up
@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);
}
 
Example 11
Source File: RippleView.java    From DoubanTop with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 12
Source File: RippleView.java    From BaseProject with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 13
Source File: CommonViewAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: RippleView.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 15
Source File: RippleView.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 16
Source File: RippleView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 17
Source File: bilibili.java    From stynico with MIT License 5 votes vote down vote up
@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);
   }
 
Example 18
Source File: ClassicMode.java    From CatchPiggy with GNU General Public License v3.0 5 votes vote down vote up
/**
 格子触摸时的动画
 */
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;
}
 
Example 19
Source File: RippleView.java    From timecat with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 20
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 4 votes vote down vote up
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);

}