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


Java ValueAnimator.setRepeatCount方法代码示例

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


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

示例1: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{500,250,0,250,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
        scaleAnim.setDuration(900);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScalePulseOutIndicator.java

示例2: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] durations=new long[]{1260, 430, 1010, 730};
    long[] delays=new long[]{770, 290, 280, 740};
    for (int i = 0; i < 4; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
        scaleAnim.setDuration(durations[i]);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:24,代码来源:LineScalePartyIndicator.java

示例3: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    float circleSpacing=4;
    float radius=(getWidth()-circleSpacing*2)/6;
    int[] delays=new int[]{70,140,210};
    for (int i = 0; i < 3; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(getHeight()/2,getHeight()/2-radius*2,getHeight()/2);
        scaleAnim.setDuration(600);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                translateYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:25,代码来源:BallPulseSyncIndicator.java

示例4: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{400,200,0,200,400};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.4f,1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScalePulseOutRapidIndicator.java

示例5: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的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:cowthan,项目名称:AyoSunny,代码行数:25,代码来源:BallRotateIndicator.java

示例6: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();

    int[] durations={960, 930, 1190, 1130, 1340, 940, 1200, 820, 1190};
    int[] delays= {360, 400, 680, 410, 710, -150, -120, 10, 320};

    for (int i = 0; i < 9; i++) {
        final int index=i;
        ValueAnimator alphaAnim=ValueAnimator.ofInt(255, 168,255);
        alphaAnim.setDuration(durations[i]);
        alphaAnim.setRepeatCount(-1);
        alphaAnim.setStartDelay(delays[i]);
        alphaAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                alphas[index] = (int) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        alphaAnim.start();
        animators.add(alphaAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:26,代码来源:BallGridBeatIndicator.java

示例7: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    int[] delays=new int[]{120,240,360};
    for (int i = 0; i < 3; i++) {
        final int index=i;
        
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
        
        scaleAnim.setDuration(750);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();

            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:27,代码来源:BallPulseIndicator.java

示例8: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{100,200,300,400,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1, 0.4f, 1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:23,代码来源:LineScaleIndicator.java

示例9: valueAnimatorRepeat

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 属性动画循环一定次数
 * @param count
 * @param animator
 * @return
 */
@NonNull
public static Animator valueAnimatorRepeat(final int count, @NonNull Animator animator) {
    if (count <= 1 && count != -1)
        return animator;

    if (animator instanceof ValueAnimator) {
        ValueAnimator valueAnimator = (ValueAnimator) animator;

        valueAnimator.setRepeatCount(Math.max(-1, count - 1));


        return valueAnimator;
    }

    return animator;
}
 
开发者ID:canyinghao,项目名称:CanAnimation,代码行数:23,代码来源:CanAnimation.java

示例10: createAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    for (int i = 0; i < CIRCLE_NUM; i++) {
        final int index = i;

        ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.3f, 1);

        scaleAnim.setDuration(BASE_DELAY_MILLIS * CIRCLE_NUM * 3 / 2);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);

        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
开发者ID:Piasy,项目名称:AndroidPlayground,代码行数:25,代码来源:BallPulseIndicator.java

示例11: parseAnimatorFromTypeArray

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * @param anim The animator, must not be null
 * @param arrayAnimator Incoming typed array for Animator's attributes.
 * @param arrayObjectAnimator Incoming typed array for Object Animator's
 *            attributes.
 */
private static void parseAnimatorFromTypeArray(ValueAnimator anim,
                                               TypedArray arrayAnimator, TypedArray arrayObjectAnimator) {
    long duration = arrayAnimator.getInt(R.styleable.Animator_android_duration, 300);

    long startDelay = arrayAnimator.getInt(R.styleable.Animator_android_startOffset, 0);

    int valueType = arrayAnimator.getInt(R.styleable.Animator_vc_valueType, 0);

    TypeEvaluator evaluator = null;

    // Must be a path animator by the time I reach here
    if (valueType == VALUE_TYPE_PATH) {
        evaluator = setupAnimatorForPath(anim, arrayAnimator);
    } else {
        throw new IllegalArgumentException("target is not a pathType target");
    }

    anim.setDuration(duration);
    anim.setStartDelay(startDelay);

    if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatCount)) {
        anim.setRepeatCount(
                arrayAnimator.getInt(R.styleable.Animator_android_repeatCount, 0));
    }
    if (arrayAnimator.hasValue(R.styleable.Animator_android_repeatMode)) {
        anim.setRepeatMode(
                arrayAnimator.getInt(R.styleable.Animator_android_repeatMode,
                        ValueAnimator.RESTART));
    }
    if (evaluator != null) {
        anim.setEvaluator(evaluator);
    }

    if (arrayObjectAnimator != null) {
        setupObjectAnimator(anim, arrayObjectAnimator);
    }
}
 
开发者ID:canyinghao,项目名称:CanDialog,代码行数:44,代码来源:PathAnimatorInflater.java

示例12: MyAnimationView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public MyAnimationView(Context context) {
    super(context);

    // Animate background color
    // Note that setting the background color will automatically invalidate the
    // view, so that the animated color, and the bouncing balls, get redisplayed on
    // every frame of the animation.
    ValueAnimator colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", RED, BLUE);
    colorAnim.setDuration(3000);
    colorAnim.setEvaluator(new ArgbEvaluator());
    colorAnim.setRepeatCount(ValueAnimator.INFINITE);
    colorAnim.setRepeatMode(ValueAnimator.REVERSE);
    colorAnim.start();
}
 
开发者ID:515445681,项目名称:NineOldAndroids-master,代码行数:15,代码来源:BouncingBalls.java

示例13: onTouchEvent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() != MotionEvent.ACTION_DOWN &&
            event.getAction() != MotionEvent.ACTION_MOVE) {
        return false;
    }
    ShapeHolder newBall = addBall(event.getX(), event.getY());

    // Bouncing animation with squash and stretch
    float startY = newBall.getY();
    float endY = getHeight() - 50f;
    float h = (float)getHeight();
    float eventY = event.getY();
    int duration = (int)(500 * ((h - eventY)/h));
    ValueAnimator bounceAnim = ObjectAnimator.ofFloat(newBall, "y", startY, endY);
    bounceAnim.setDuration(duration);
    bounceAnim.setInterpolator(new AccelerateInterpolator());
    ValueAnimator squashAnim1 = ObjectAnimator.ofFloat(newBall, "x", newBall.getX(),
            newBall.getX() - 25f);
    squashAnim1.setDuration(duration/4);
    squashAnim1.setRepeatCount(1);
    squashAnim1.setRepeatMode(ValueAnimator.REVERSE);
    squashAnim1.setInterpolator(new DecelerateInterpolator());
    ValueAnimator squashAnim2 = ObjectAnimator.ofFloat(newBall, "width", newBall.getWidth(),
            newBall.getWidth() + 50);
    squashAnim2.setDuration(duration/4);
    squashAnim2.setRepeatCount(1);
    squashAnim2.setRepeatMode(ValueAnimator.REVERSE);
    squashAnim2.setInterpolator(new DecelerateInterpolator());
    ValueAnimator stretchAnim1 = ObjectAnimator.ofFloat(newBall, "y", endY,
            endY + 25f);
    stretchAnim1.setDuration(duration/4);
    stretchAnim1.setRepeatCount(1);
    stretchAnim1.setInterpolator(new DecelerateInterpolator());
    stretchAnim1.setRepeatMode(ValueAnimator.REVERSE);
    ValueAnimator stretchAnim2 = ObjectAnimator.ofFloat(newBall, "height",
            newBall.getHeight(), newBall.getHeight() - 25);
    stretchAnim2.setDuration(duration/4);
    stretchAnim2.setRepeatCount(1);
    stretchAnim2.setInterpolator(new DecelerateInterpolator());
    stretchAnim2.setRepeatMode(ValueAnimator.REVERSE);
    ValueAnimator bounceBackAnim = ObjectAnimator.ofFloat(newBall, "y", endY,
            startY);
    bounceBackAnim.setDuration(duration);
    bounceBackAnim.setInterpolator(new DecelerateInterpolator());
    // Sequence the down/squash&stretch/up animations
    AnimatorSet bouncer = new AnimatorSet();
    bouncer.play(bounceAnim).before(squashAnim1);
    bouncer.play(squashAnim1).with(squashAnim2);
    bouncer.play(squashAnim1).with(stretchAnim1);
    bouncer.play(squashAnim1).with(stretchAnim2);
    bouncer.play(bounceBackAnim).after(stretchAnim2);

    // Fading animation - remove the ball when the animation is done
    ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
    fadeAnim.setDuration(250);
    fadeAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            balls.remove(((ObjectAnimator)animation).getTarget());

        }
    });

    // Sequence the two animations to play one after the other
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(bouncer).before(fadeAnim);

    // Start the animation
    animatorSet.start();

    return true;
}
 
开发者ID:515445681,项目名称:NineOldAndroids-master,代码行数:74,代码来源:BouncingBalls.java


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