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


Java ObjectAnimator.setRepeatCount方法代码示例

本文整理汇总了Java中android.animation.ObjectAnimator.setRepeatCount方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.setRepeatCount方法的具体用法?Java ObjectAnimator.setRepeatCount怎么用?Java ObjectAnimator.setRepeatCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.ObjectAnimator的用法示例。


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

示例1: animateDisplayWave

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * 动画
 */
private void animateDisplayWave() {
    if (left_WaveView != null && center_WaveView != null) {
        left_WaveView.setAnimationCacheEnabled(false);
        center_WaveView.setAnimationCacheEnabled(false);
        ObjectAnimator transX_waveLeft = ObjectAnimator.ofFloat(left_WaveView, "translationX", 0, 1920);
        ObjectAnimator transX_waveCenter = ObjectAnimator.ofFloat(center_WaveView, "translationX", 0, 1920);
        transX_waveLeft.setRepeatMode(ValueAnimator.RESTART);
        transX_waveLeft.setRepeatCount(Animation.INFINITE);
        transX_waveCenter.setRepeatMode(ValueAnimator.RESTART);
        transX_waveCenter.setRepeatCount(Animation.INFINITE);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(16000);
        animatorSet.setInterpolator(new LinearInterpolator());
        animatorSet.playTogether(transX_waveLeft, transX_waveCenter);
        animatorSet.start();
    }
}
 
开发者ID:NickKJ,项目名称:WavesView,代码行数:21,代码来源:WavePicView.java

示例2: build

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * build a copy of given animator
 *
 * @return
 */
public Animator build() {
    //这种方式clone出来的animator不能重复播放
    /*final ObjectAnimator result = getAnimator().clone();//克隆一份
    setupListeners(result);
    result.setupStartValues();
    return result;*/

    final ObjectAnimator self = this.getAnimator();
    final ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(self.getTarget());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        anim.setAutoCancel(true);
    }
    if (self.getValues() != null) {
        anim.setValues(self.getValues());
    }
    anim.setInterpolator(self.getInterpolator());
    anim.setDuration(self.getDuration());
    anim.setStartDelay(self.getStartDelay());
    anim.setRepeatCount(self.getRepeatCount());
    anim.setRepeatMode(self.getRepeatMode());
    setupListeners(anim);
    return anim;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:30,代码来源:UDAnimator.java

示例3: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    ValueAnimator scaleAnim=ValueAnimator.ofFloat(0.5f,1,0.5f);
    scaleAnim.setDuration(1000);
    scaleAnim.setRepeatCount(-1);
    scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            scaleFloat = (float) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    scaleAnim.start();

    ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
    rotateAnim.setDuration(1000);
    rotateAnim.setRepeatCount(-1);
    rotateAnim.start();

    animators.add(scaleAnim);
    animators.add(rotateAnim);
    return animators;
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:25,代码来源:BallRotateIndicator.java

示例4: generateAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private Animator generateAnimation() {

        ObjectAnimator blink = ObjectAnimator.ofFloat(this, "waveScale", 0f, 1f);
        blink.setDuration(priority);
        if (playInterpolator != null) {
            blink.setInterpolator(playInterpolator);
        }

        blink.setRepeatCount(Animation.INFINITE);
        blink.setRepeatMode(Animation.INFINITE);

        ObjectAnimator alphaAnimator = ObjectAnimator.ofInt(this, "alpha", 255, 0);
        alphaAnimator.setDuration(priority);
        if (alphaInterpolator != null) {
            alphaAnimator.setInterpolator(alphaInterpolator);
        }
        alphaAnimator.setRepeatCount(Animation.INFINITE);
        alphaAnimator.setRepeatMode(Animation.INFINITE);

        animatorSet.playTogether(blink, alphaAnimator);

        return animatorSet;
    }
 
开发者ID:alshell7,项目名称:terminal-seekbar,代码行数:24,代码来源:TerminalBackDrawable.java

示例5: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationX",0,360);
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(1500);
    animator.start();
    List<Animator> animators=new ArrayList<>();
    animators.add(animator);
    return animators;
}
 
开发者ID:magicbaby810,项目名称:SRecyclerView,代码行数:13,代码来源:BallPulseRiseIndicator.java

示例6: animateAnimatorSetSample

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateAnimatorSetSample(ImageView target) {

		// Set AnimatorList(Will set on AnimatorSet)
		List<Animator> animatorList= new ArrayList<Animator>();

		// alphaプロパティを0fから1fに変化させます
		PropertyValuesHolder alphaAnimator = PropertyValuesHolder.ofFloat("alpha", minAlpha ,maxAlpha, minAlpha);

		PropertyValuesHolder flipAnimator = PropertyValuesHolder.ofFloat(orientation, startAngle, endAngle);

		ObjectAnimator translationAnimator =
				ObjectAnimator.ofPropertyValuesHolder(target, alphaAnimator, flipAnimator);
		translationAnimator.setDuration(duration);
		translationAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
//		// faster
//		translationAnimator.setInterpolator(new AccelerateInterpolator());
//		// slower
//		translationAnimator.setInterpolator(new DecelerateInterpolator());
//		// fast->slow->fast
//		translationAnimator.setInterpolator(new AccelerateDecelerateInterpolator());

		// repeat translationAnimator
		translationAnimator.setRepeatCount(ObjectAnimator.INFINITE);
		// Set all animation to animatorList
		animatorList.add(translationAnimator);

		final AnimatorSet animatorSet = new AnimatorSet();
		// Set animatorList to animatorSet
		animatorSet.playSequentially(animatorList);

		// Start Animation
		animatorSet.start();
	}
 
开发者ID:Taishi-Y,项目名称:FlipProgressDialog,代码行数:34,代码来源:FlipProgressDialog.java

示例7: startAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
void startAnimation() {
    // This variation uses an ObjectAnimator. The functionality is exactly the same as
    // in Bouncer2, but this time the boilerplate code is greatly reduced because we
    // tell ObjectAnimator to automatically animate the target object for us, so we no
    // longer need to listen for frame updates and do that work ourselves.
    ObjectAnimator anim = getObjectAnimator();
    anim.setRepeatCount(ValueAnimator.INFINITE);
    anim.setRepeatMode(ValueAnimator.REVERSE);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:12,代码来源:Bouncer3.java

示例8: ProgressBarView

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public ProgressBarView(ContainerType containerType, ViewGroup container,
        XSharedPreferences prefs, ProgressBarController ctrl) {
    super(container.getContext());

    mContainerType = containerType;
    mCtrl = ctrl;

    mAnimated = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_ANIMATED, true);
    mCentered = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_CENTERED, false);
    mHeightPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_THICKNESS, 1),
            getResources().getDisplayMetrics());
    mEdgeMarginPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_MARGIN, 0),
            getResources().getDisplayMetrics());

    setScaleX(0f);
    setBackgroundColor(Color.WHITE);
    setVisibility(View.GONE);
    container.addView(this);

    mAnimator = new ObjectAnimator();
    mAnimator.setTarget(this);
    mAnimator.setInterpolator(new DecelerateInterpolator());
    mAnimator.setDuration(ANIM_DURATION);
    mAnimator.setRepeatCount(0);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:28,代码来源:ProgressBarView.java

示例9: setRepeatCount

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
 * 重复次数,负数标示无限
 *
 * @param repeatCount
 * @return
 */
public UDAnimator setRepeatCount(int repeatCount) {
    final ObjectAnimator animator = getAnimator();
    if (animator != null) {
        if (repeatCount >= 0) {
            animator.setRepeatCount(repeatCount);
        } else {
            animator.setRepeatCount(ValueAnimator.INFINITE);
        }
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:18,代码来源:UDAnimator.java

示例10: createLoadingAnimator

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private Animator createLoadingAnimator() {
    ObjectAnimator rotation = ObjectAnimator
            .ofFloat(mImgLoading, "rotation", 0, 360);
    //RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotation.setRepeatCount(ObjectAnimator.INFINITE);
    rotation.setRepeatMode(ObjectAnimator.RESTART);
    rotation.setInterpolator(new LinearInterpolator());
    rotation.setDuration(mLoadingTime);
    return rotation;
}
 
开发者ID:imliujun,项目名称:LJFramework,代码行数:11,代码来源:LoadingRefreshHeader.java

示例11: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:14,代码来源:SquareSpinIndicator.java

示例12: createAnimation

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();

    animators.add(animator);
    return animators;
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:16,代码来源:TriangleSkewSpinIndicator.java

示例13: init

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    if (null == attrs) {
        throw new IllegalArgumentException("Attributes should be provided to this view,");
    }

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleBackground);
    rippleColor = typedArray.getColor(R.styleable.RippleBackground_rb_color, Color.parseColor("#0099CC"));
    rippleStrokeWidth = typedArray.getDimension(R.styleable.RippleBackground_rb_strokeWidth, getResources().getDisplayMetrics().density * 4);
    rippleRadius = typedArray.getDimension(R.styleable.RippleBackground_rb_radius, getResources().getDisplayMetrics().density * 60);
    rippleDurationTime = typedArray.getInt(R.styleable.RippleBackground_rb_duration, DEFAULT_DURATION_TIME);
    rippleAmount = typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount, DEFAULT_RIPPLE_COUNT);
    rippleScale = typedArray.getFloat(R.styleable.RippleBackground_rb_scale, DEFAULT_SCALE);
    rippleType = typedArray.getInt(R.styleable.RippleBackground_rb_type, DEFAULT_FILL_TYPE);
    typedArray.recycle();

    rippleDelay = rippleDurationTime / rippleAmount;

    paint = new Paint();
    paint.setAntiAlias(true);
    if (rippleType == DEFAULT_FILL_TYPE) {
        rippleStrokeWidth = 0;
        paint.setStyle(Paint.Style.FILL);
    } else
        paint.setStyle(Paint.Style.STROKE);
    paint.setColor(rippleColor);

    rippleParams = new LayoutParams((int) (2 * (rippleRadius + rippleStrokeWidth)), (int) (2 * (rippleRadius + rippleStrokeWidth)));
    rippleParams.addRule(CENTER_IN_PARENT, TRUE);

    animatorSet = new AnimatorSet();
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorList = new ArrayList<Animator>();

    for (int i = 0; i < rippleAmount; i++) {
        RippleView rippleView = new RippleView(getContext());
        addView(rippleView, rippleParams);
        rippleViewList.add(rippleView);
        final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", 1.0f, rippleScale);
        scaleXAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleXAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleXAnimator.setStartDelay(i * rippleDelay);
        scaleXAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleXAnimator);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", 1.0f, rippleScale);
        scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleYAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleYAnimator.setStartDelay(i * rippleDelay);
        scaleYAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleYAnimator);
        final ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", 1.0f, 0f);
        alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
        alphaAnimator.setStartDelay(i * rippleDelay);
        alphaAnimator.setDuration(rippleDurationTime);
        animatorList.add(alphaAnimator);
    }

    animatorSet.playTogether(animatorList);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:63,代码来源:RippleBackground.java

示例14: init

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void init(final Context context, final AttributeSet attrs) {
    if (isInEditMode())
        return;

    if (null == attrs) {
        throw new IllegalArgumentException("Attributes should be provided to this view,");
    }

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleBackground);
    rippleColor=typedArray.getColor(R.styleable.RippleBackground_rb_color, getResources().getColor(R.color.rippelColor));
    rippleStrokeWidth=typedArray.getDimension(R.styleable.RippleBackground_rb_strokeWidth, getResources().getDimension(R.dimen.rippleStrokeWidth));
    rippleRadius=typedArray.getDimension(R.styleable.RippleBackground_rb_radius,getResources().getDimension(R.dimen.rippleRadius));
    rippleDurationTime=typedArray.getInt(R.styleable.RippleBackground_rb_duration,DEFAULT_DURATION_TIME);
    rippleAmount=typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount,DEFAULT_RIPPLE_COUNT);
    rippleScale=typedArray.getFloat(R.styleable.RippleBackground_rb_scale,DEFAULT_SCALE);
    rippleType=typedArray.getInt(R.styleable.RippleBackground_rb_type,DEFAULT_FILL_TYPE);
    typedArray.recycle();

    rippleDelay=rippleDurationTime/rippleAmount;

    paint = new Paint();
    paint.setAntiAlias(true);
    if(rippleType==DEFAULT_FILL_TYPE){
        rippleStrokeWidth=0;
        paint.setStyle(Paint.Style.FILL);
    }else
        paint.setStyle(Paint.Style.STROKE);
    paint.setColor(rippleColor);

    rippleParams=new LayoutParams((int)(2*(rippleRadius+rippleStrokeWidth)),(int)(2*(rippleRadius+rippleStrokeWidth)));
    rippleParams.addRule(CENTER_IN_PARENT, TRUE);

    animatorSet = new AnimatorSet();
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorList=new ArrayList<Animator>();

    for(int i=0;i<rippleAmount;i++){
        RippleView rippleView=new RippleView(getContext());
        addView(rippleView,rippleParams);
        rippleViewList.add(rippleView);
         final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", 1.0f, rippleScale);
        scaleXAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleXAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleXAnimator.setStartDelay(i * rippleDelay);
        scaleXAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleXAnimator);
        final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", 1.0f, rippleScale);
        scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        scaleYAnimator.setRepeatMode(ObjectAnimator.RESTART);
        scaleYAnimator.setStartDelay(i * rippleDelay);
        scaleYAnimator.setDuration(rippleDurationTime);
        animatorList.add(scaleYAnimator);
        final ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", 1.0f, 0f);
        alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
        alphaAnimator.setStartDelay(i * rippleDelay);
        alphaAnimator.setDuration(rippleDurationTime);
        animatorList.add(alphaAnimator);
    }

    animatorSet.playTogether(animatorList);
}
 
开发者ID:fergus825,项目名称:SmartOrnament,代码行数:63,代码来源:RippleBackground.java

示例15: initializeAnimators

import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void initializeAnimators(float startRadius, float endRadius, int duration) {
    mAnimatorSet = new AnimatorSet();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(mRippleView, "radius", startRadius, endRadius);
    scaleXAnimator.setRepeatCount(ValueAnimator.INFINITE);

    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mRippleView, "alpha", 1f, 0f);
    alphaAnimator.setRepeatCount(ValueAnimator.INFINITE);

    mAnimatorSet.setDuration(duration);
    mAnimatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimatorSet.playTogether(scaleXAnimator, alphaAnimator);
}
 
开发者ID:gaurav414u,项目名称:android-ripple-pulse-animation,代码行数:13,代码来源:RipplePulseLayout.java


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