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


Java ValueAnimator.setRepeatMode方法代码示例

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


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

示例1: startWaveAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 动画
 */
private void startWaveAnimation() {
    Point startPoint = new Point(0, START_POSITION);
    Point endPoint = new Point(1920, START_POSITION);
    ValueAnimator anim = ValueAnimator.ofObject(new PointEvaluator(), startPoint, endPoint);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            currentPoint = (Point) animation.getAnimatedValue();
            invalidate();
        }
    });
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(duration);
    anim.setRepeatMode(ValueAnimator.RESTART);
    anim.setRepeatCount(Animation.INFINITE);
    anim.start();
}
 
开发者ID:NickKJ,项目名称:WavesView,代码行数:21,代码来源:WaveViewDraw.java

示例2: createValueAnimator

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public static ValueAnimator createValueAnimator(AnimatedDrawable2 animatedDrawable) {
  int loopCount = animatedDrawable.getLoopCount();
  ValueAnimator animator = new ValueAnimator();
  animator.setIntValues(0, (int) animatedDrawable.getLoopDurationMs());
  animator.setDuration(animatedDrawable.getLoopDurationMs());
  animator.setRepeatCount(
      loopCount != AnimationInformation.LOOP_COUNT_INFINITE ? loopCount : ValueAnimator.INFINITE);
  animator.setRepeatMode(ValueAnimator.RESTART);
  // Use a linear interpolator
  animator.setInterpolator(null);
  ValueAnimator.AnimatorUpdateListener animatorUpdateListener =
      createAnimatorUpdateListener(animatedDrawable);
  animator.addUpdateListener(animatorUpdateListener);
  return animator;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:AnimatedDrawable2ValueAnimatorHelper.java

示例3: initViews

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initViews() {
    this.buttonOk = (Button) findViewById(R.id.button_ok);
    this.buttonShow = (Button) findViewById(R.id.button_show);
    this.textDescription = (TextView) findViewById(R.id.text_description);
    this.buttonHello = (Button) findViewById(R.id.button_hello);
    this.toolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(toolbar);

    tutors = new TutorsBuilder()
            .textColorRes(android.R.color.white)
            .shadowColorRes(R.color.shadow)
            .textSizeRes(R.dimen.textNormal)
            .completeIconRes(R.drawable.ic_cross_24_white)
            .spacingRes(R.dimen.spacingNormal)
            .lineWidthRes(R.dimen.lineWidth)
            .cancelable(false)
            .build();

    buttonShow.setOnClickListener(this);

    tutors.setListener(this);

    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            MainActivity.this.buttonHello.setAlpha((Float) animation.getAnimatedValue());
        }
    });

    animator.setDuration(500);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(-1);
    animator.start();
}
 
开发者ID:Popalay,项目名称:Tutors,代码行数:37,代码来源:MainActivity.java

示例4: animateFailedSet

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Change card color. This method wraps the Property Animation API mentioned here
 * https://stackoverflow.com/a/14467625/7009268
 */
public void animateFailedSet() {
    int colorFrom = ContextCompat.getColor(getContext(), R.color.card_background_normal);
    int colorTo = ContextCompat.getColor(getContext(), R.color.fbutton_color_carrot);
    final SetGameCardView card = this;

    int duration = getContext().getResources().getInteger(R.integer.card_fail_animation_duration_flash);

    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
    colorAnimation.setDuration(duration); // milliseconds
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            card.setCardBackgroundColor((int) animator.getAnimatedValue());
        }
    });
    colorAnimation.setRepeatMode(ValueAnimator.REVERSE);
    colorAnimation.setRepeatCount(2);
    colorAnimation.start();

    colorAnimation.addListener(new AnimatorListenerAdapter()
    {
        @Override
        public void onAnimationEnd(Animator animation)
        {
            // Once animation is over, animate back to selected or highlighted or normal
            card.setChecked(false, false);
            if (isHighlighted()) {
                animateColorChange(R.color.fbutton_color_alizarin, R.color.card_background_highlighted);
            } else {
                animateColorChange(R.color.fbutton_color_alizarin, R.color.card_background_normal);
            }
        }
    });
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:39,代码来源:SetGameCardView.java

示例5: dynamicGap

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void dynamicGap(CompositionAvatarView view) {
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
    animator.setDuration(2000);
    animator.setStartDelay(1000);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.addUpdateListener(animation -> view.setGap((Float) animation.getAnimatedValue()));

    mGapAnimator = animator;
}
 
开发者ID:YiiGuxing,项目名称:CompositionAvatar,代码行数:12,代码来源:SampleActivity.java

示例6: startAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
void startAnimation() {
    ValueAnimator anim = getValueAnimator();
    // In this variation, we put the shape into an infinite bounce, where it keeps moving
    // up and down. Note that it's still not actually "bouncing" because it just uses
    // default time interpolation.
    anim.setRepeatCount(ValueAnimator.INFINITE);
    anim.setRepeatMode(ValueAnimator.REVERSE);
    anim.start();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:10,代码来源:Bouncer1.java

示例7: startAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
void startAnimation() {
    ValueAnimator anim = getValueAnimator();
    anim.setRepeatCount(ValueAnimator.INFINITE);
    anim.setRepeatMode(ValueAnimator.REVERSE);
    // This variation finally has the shape bouncing, due to the use of an
    // AccelerateInterpolator, which speeds up as the animation proceed. Note that
    // when the animation reverses, the interpolator acts in reverse, decelerating
    // movement.
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:12,代码来源:Bouncer2.java

示例8: initShinyAnimators

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initShinyAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
    final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
    opacityAnimator.setInterpolator(new DecelerateInterpolator(opacityDecelerateFactor));
    opacityAnimator.setIntValues(255, 50, 255);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
 
开发者ID:vulko,项目名称:AnimatedArcProgressView,代码行数:14,代码来源:OpacityAnimation.java

示例9: initAuraAnimators

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void initAuraAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
    final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
    opacityAnimator.setInterpolator(new AnticipateInterpolator(opacityDecelerateFactor));
    opacityAnimator.setIntValues(255, 50, 255, 50);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
 
开发者ID:vulko,项目名称:AnimatedArcProgressView,代码行数:14,代码来源:OpacityAnimation.java

示例10: PictureProgressbar

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public PictureProgressbar(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    drawable = getResources().getDrawable(R.drawable.i00);
    float density = getResources().getDisplayMetrics().density;
    pictureWidth = (int) (drawable.getIntrinsicWidth() / density);
    pictureHeight = (int) (drawable.getIntrinsicHeight() / density);
    Logger.e("图片高度:%d", pictureHeight);

    bgPaint = new Paint();
    bgPaint.setColor(getResources().getColor(R.color.progressbg));
    progressPaint = new Paint();
    progressPaint.setColor(getResources().getColor(R.color.progressColor));
    bitmapPaint = new Paint();

    fullSizeProgressbarRectf = new RectF();
    progressRectf = new RectF();

    rectRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
            getResources().getDisplayMetrics());

    drawableIds = new int[]{R.drawable.i00, R.drawable.i01, R.drawable.i02, R.drawable.i03,
            R.drawable.i04, R.drawable.i05, R.drawable.i06};

    ValueAnimator animator = ValueAnimator.ofInt(0, 100);
    animator.setDuration(10000);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.setInterpolator(new LinearInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            int index = ((int) animation.getAnimatedValue()) % drawableIds.length;
            drawable = getResources().getDrawable(drawableIds[index]);
            postInvalidate();
        }
    });
    animator.start();

}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:40,代码来源:PictureProgressbar.java

示例11: setupAnimations

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void setupAnimations() {
    mScrollAnimator = new ValueAnimator();
    mScrollAnimator.setFloatValues(0, 1);
    mScrollAnimator.setRepeatCount(Animation.INFINITE);
    mScrollAnimator.setRepeatMode(ValueAnimator.RESTART);
    mScrollAnimator.setInterpolator(LINEAR_INTERPOLATOR);
    mScrollAnimator.setDuration(ANIMATION_DURATION);
    mScrollAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setRotate((float) animation.getAnimatedValue());
        }
    });

}
 
开发者ID:tohodog,项目名称:QSRefreshLayout,代码行数:16,代码来源:SunRefreshDraw.java

示例12: setupAnimations

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private void setupAnimations() {
    mScrollAnimator = new ValueAnimator();
    mScrollAnimator.setFloatValues(0, 1);
    mScrollAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
    mScrollAnimator.setDuration(ANIMATION_DURATION);
    mScrollAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mScrollAnimator.setRepeatMode(ValueAnimator.REVERSE);
    mScrollAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            setLoadingAnimationTime((float) animation.getAnimatedValue());
        }
    });

}
 
开发者ID:tohodog,项目名称:QSRefreshLayout,代码行数:16,代码来源:PlainRefreshDraw.java

示例13: doHappyJump

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 跳跃动画
 * @param view  视图
 * @param jumpHeight 跳跃高度
 * @param duration  时间
 * @return  Animator
 */
public static Animator doHappyJump(View view, int jumpHeight, int duration) {
    Keyframe scaleXFrame1 = Keyframe.ofFloat(0f, 1.0f);
    Keyframe scaleXFrame2 = Keyframe.ofFloat(0.05f, 1.5f);
    Keyframe scaleXFrame3 = Keyframe.ofFloat(0.1f, 0.8f);
    Keyframe scaleXFrame4 = Keyframe.ofFloat(0.15f, 1.0f);
    Keyframe scaleXFrame5 = Keyframe.ofFloat(0.5f, 1.0f);
    Keyframe scaleXFrame6 = Keyframe.ofFloat(0.55f, 1.5f);
    Keyframe scaleXFrame7 = Keyframe.ofFloat(0.6f, 0.8f);
    Keyframe scaleXFrame8 = Keyframe.ofFloat(0.65f, 1.0f);
    PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofKeyframe("scaleX",
            scaleXFrame1, scaleXFrame2, scaleXFrame3, scaleXFrame4,
            scaleXFrame5, scaleXFrame6, scaleXFrame7, scaleXFrame8);

    Keyframe scaleYFrame1 = Keyframe.ofFloat(0f, 1.0f);
    Keyframe scaleYFrame2 = Keyframe.ofFloat(0.05f, 0.5f);
    Keyframe scaleYFrame3 = Keyframe.ofFloat(0.1f, 1.15f);
    Keyframe scaleYFrame4 = Keyframe.ofFloat(0.15f, 1.0f);
    Keyframe scaleYFrame5 = Keyframe.ofFloat(0.5f, 1.0f);
    Keyframe scaleYFrame6 = Keyframe.ofFloat(0.55f, 0.5f);
    Keyframe scaleYFrame7 = Keyframe.ofFloat(0.6f, 1.15f);
    Keyframe scaleYFrame8 = Keyframe.ofFloat(0.65f, 1.0f);
    PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofKeyframe("scaleY",
            scaleYFrame1, scaleYFrame2, scaleYFrame3, scaleYFrame4,
            scaleYFrame5, scaleYFrame6, scaleYFrame7, scaleYFrame8);

    Keyframe translationY1 = Keyframe.ofFloat(0f, 0f);
    Keyframe translationY2 = Keyframe.ofFloat(0.085f, 0f);
    Keyframe translationY3 = Keyframe.ofFloat(0.2f, -jumpHeight);
    Keyframe translationY4 = Keyframe.ofFloat(0.25f, -jumpHeight);
    Keyframe translationY5 = Keyframe.ofFloat(0.375f, 0f);
    Keyframe translationY6 = Keyframe.ofFloat(0.5f, 0f);
    Keyframe translationY7 = Keyframe.ofFloat(0.585f, 0f);
    Keyframe translationY8 = Keyframe.ofFloat(0.7f, -jumpHeight);
    Keyframe translationY9 = Keyframe.ofFloat(0.75f, -jumpHeight);
    Keyframe translationY10 = Keyframe.ofFloat(0.875f, 0f);
    PropertyValuesHolder translationYHolder = PropertyValuesHolder.ofKeyframe("translationY",
            translationY1, translationY2, translationY3, translationY4, translationY5,
            translationY6, translationY7, translationY8, translationY9, translationY10);

    Keyframe rotationY1 = Keyframe.ofFloat(0f, 0f);
    Keyframe rotationY2 = Keyframe.ofFloat(0.125f, 0f);
    Keyframe rotationY3 = Keyframe.ofFloat(0.3f, -360f * 3);
    PropertyValuesHolder rotationYHolder = PropertyValuesHolder.ofKeyframe("rotationY",
            rotationY1, rotationY2, rotationY3);

    Keyframe rotationX1 = Keyframe.ofFloat(0f, 0f);
    Keyframe rotationX2 = Keyframe.ofFloat(0.625f, 0f);
    Keyframe rotationX3 = Keyframe.ofFloat(0.8f, -360f * 3);
    PropertyValuesHolder rotationXHolder = PropertyValuesHolder.ofKeyframe("rotationX",
            rotationX1, rotationX2, rotationX3);

    ValueAnimator valueAnimator = ObjectAnimator.ofPropertyValuesHolder(view,
            scaleXHolder, scaleYHolder, translationYHolder, rotationYHolder, rotationXHolder);
    valueAnimator.setDuration(duration);
    valueAnimator.setRepeatMode(ValueAnimator.RESTART);
    valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.start();
    return valueAnimator;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:68,代码来源:AnimateHelper.java

示例14: animate

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
     * Animates all dots in sequential order.
     */
    @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
    public void animate() {
        int startDelay = 0;

        mAnimSet = new AnimatorSet();

        for (int i = 0; i < mImageViewList.size(); i++) {
            ImageView dot = mImageViewList.get(i);
//            ValueAnimator bounce = ObjectAnimator.ofFloat(dot, "y", mAnimMagnitude);
            ValueAnimator fadeIn = ObjectAnimator.ofFloat(dot, "alpha", 1f, 0.5f);
            ValueAnimator scaleX = ObjectAnimator.ofFloat(dot, "scaleX", 1f, 0.7f);
            ValueAnimator scaleY = ObjectAnimator.ofFloat(dot, "scaleY", 1f, 0.7f);

            fadeIn.setDuration(mAnimDuration);
            fadeIn.setInterpolator(new AccelerateDecelerateInterpolator());
            fadeIn.setRepeatMode(ValueAnimator.REVERSE);
            fadeIn.setRepeatCount(ValueAnimator.INFINITE);

            scaleX.setDuration(mAnimDuration);
            scaleX.setInterpolator(new AccelerateDecelerateInterpolator());
            scaleX.setRepeatMode(ValueAnimator.REVERSE);
            scaleX.setRepeatCount(ValueAnimator.INFINITE);

            scaleY.setDuration(mAnimDuration);
            scaleY.setInterpolator(new AccelerateDecelerateInterpolator());
            scaleY.setRepeatMode(ValueAnimator.REVERSE);
            scaleY.setRepeatCount(ValueAnimator.INFINITE);

//            bounce.setDuration(mAnimDuration);
//            bounce.setInterpolator(new AccelerateDecelerateInterpolator());
//            bounce.setRepeatMode(ValueAnimator.REVERSE);
//            bounce.setRepeatCount(ValueAnimator.INFINITE);

//            mAnimSet.play(bounce).after(startDelay);
            mAnimSet.play(fadeIn).after(startDelay);
            mAnimSet.play(scaleX).with(fadeIn);
            mAnimSet.play(scaleY).with(fadeIn);

            mAnimSet.setStartDelay(500);

            startDelay += (mAnimDuration / (mImageViewList.size() - 1));
        }

        mAnimSet.start();
    }
 
开发者ID:narenkukreja,项目名称:quire,代码行数:49,代码来源:TypingIndicator.java

示例15: initAnimators

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
     * Init opacity animators.
     */
    private void initAnimators() {
        mAlphaOpacityList.clear();
        for (int i = 0; i < mAnimatorCount; ++i) {
            mAlphaOpacityList.add(mInitialOpacity);
        }

        for (int i = 0; i < mAnimatorCount; ++ i) {
            final ValueAnimator opacityAnimator = new ValueAnimator();

            opacityAnimator.setDuration(getDuration());
//                opacityAnimator.setStartDelay(ANIMATION_START_DELAY);
            opacityAnimator.setRepeatCount(ValueAnimator.INFINITE);
            opacityAnimator.setRepeatMode(ValueAnimator.RESTART);

            switch (mType) {
                case OpacityAnimation.NONE:
                    // no need to init anything
                    return;

                case OpacityAnimation.BLINKING:
                    initBlinkingAnimators(i, opacityAnimator);
                    break;

                case OpacityAnimation.SHINY:
                    initShinyAnimators(i, opacityAnimator);
                    break;

                case OpacityAnimation.AURA:
                    initAuraAnimators(i, opacityAnimator);
                    break;

                case OpacityAnimation.RIPPLE:
                    initRippleAnimators(i, opacityAnimator);
                    // no need to go through loop in case of this animation
                    return;
            }

            mOpacityValueAnimatorList.add(opacityAnimator);
        }
    }
 
开发者ID:vulko,项目名称:AnimatedArcProgressView,代码行数:44,代码来源:OpacityAnimation.java


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