android.animation.ObjectAnimator.setRepeatMode()

Here are the examples of the java api android.animation.ObjectAnimator.setRepeatMode() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

94 Examples 7

18 Source : UDAnimator.java
with GNU General Public License v3.0
from VideoOS

/**
 * 重复方式(1 default, -1 infinite, 2 reverse)
 *
 * @param repeatMode
 * @return
 */
public UDAnimator setRepeatMode(int repeatMode) {
    ObjectAnimator animator = getAnimator();
    if (animator != null) {
        animator.setRepeatMode(repeatMode);
    }
    return this;
}

18 Source : UDAnimator.java
with MIT License
from alibaba

/**
 * 重复方式(1 default, -1 infinite, 2 reverse)
 *
 * @param repeatMode
 * @return
 */
public UDAnimator setRepeatMode(int repeatMode) {
    final ObjectAnimator animator = getAnimator();
    if (animator != null) {
        animator.setRepeatMode(repeatMode);
    }
    return this;
}

17 Source : CircularAnimatedDrawable.java
with Apache License 2.0
from triline3

private void setupAnimations() {
    mObjectAnimatorAngle = ObjectAnimator.ofFloat(this, mAngleProperty, 360f);
    mObjectAnimatorAngle.setInterpolator(ANGLE_INTERPOLATOR);
    mObjectAnimatorAngle.setDuration(ANGLE_ANIMATOR_DURATION);
    mObjectAnimatorAngle.setRepeatMode(ValueAnimator.RESTART);
    mObjectAnimatorAngle.setRepeatCount(ValueAnimator.INFINITE);
    mObjectAnimatorSweep = ObjectAnimator.ofFloat(this, mSweepProperty, 360f - MIN_SWEEP_ANGLE * 2);
    mObjectAnimatorSweep.setInterpolator(SWEEP_INTERPOLATOR);
    mObjectAnimatorSweep.setDuration(SWEEP_ANIMATOR_DURATION);
    mObjectAnimatorSweep.setRepeatMode(ValueAnimator.RESTART);
    mObjectAnimatorSweep.setRepeatCount(ValueAnimator.INFINITE);
    mObjectAnimatorSweep.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
            toggleAppearingMode();
        }
    });
}

17 Source : CircularAnimatedDrawable.java
with Apache License 2.0
from nihasKalam07

private void setupAnimations(float angleToDraw) {
    // - MIN_SWEEP_ANGLE * 2);
    mObjectAnimatorSweep = ObjectAnimator.ofFloat(this, mSweepProperty, angleToDraw);
    mObjectAnimatorSweep.setInterpolator(SWEEP_INTERPOLATOR);
    if (mIndeterminateProgressMode) {
        mObjectAnimatorSweep.setDuration(SWEEP_ANIMATOR_DURATION);
        mObjectAnimatorSweep.setRepeatMode(ValueAnimator.RESTART);
        mObjectAnimatorSweep.setRepeatCount(ValueAnimator.INFINITE);
    } else {
        mObjectAnimatorSweep.setDuration(mCustomSweepDuration == -1 ? SWEEP_ANIMATOR_DURATION : mCustomSweepDuration);
    }
    mObjectAnimatorSweep.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (customProgressMode) {
                if (customProgress != 360) {
                    return;
                }
            }
            if (mListener != null) {
                mListener.onAnimationEnd();
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    mObjectAnimatorSweep.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            if (customProgressMode) {
                return;
            }
            if (onAnimationUpdateListener != null)
                onAnimationUpdateListener.onAnimationTimeUpdate((int) valueAnimator.getCurrentPlayTime(), mCustomSweepDuration);
        }
    });
}

17 Source : AlbumIconAnimManager.java
with MIT License
from jrfeng

private void initDiskRotateAnim() {
    mRunning = false;
    mDiskRotateAnimator = ObjectAnimator.ofFloat(mTarget, "rotation", 0, 360);
    mDiskRotateAnimator.setDuration(20_000);
    mDiskRotateAnimator.setRepeatCount(-1);
    mDiskRotateAnimator.setRepeatMode(ObjectAnimator.RESTART);
    mDiskRotateAnimator.setInterpolator(new LinearInterpolator());
    mPlayerViewModel.getPlayingNoStalled().observe(mLifecycleOwner, playingNoStalled -> {
        if (playingNoStalled) {
            resumeAnim();
        } else {
            pauseAnim();
        }
    });
}

17 Source : FlowerGiftView.java
with Apache License 2.0
from FreeSunny

private ObjectAnimator getScale(int count) {
    scale = ObjectAnimator.ofFloat(giftCount, "scale", 1.0f, 2.0f, 1.0f);
    scale.setDuration(500);
    scale.setRepeatCount(count - 1);
    scale.setRepeatMode(ObjectAnimator.RESTART);
    scale.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationRepeat(Animator animation) {
            super.onAnimationRepeat(animation);
            giftCount.setText("x " + (++incTimes) + " ");
        }
    });
    return scale;
}

16 Source : MusicPlayerActivity.java
with Apache License 2.0
from zion223

private void initAnimator() {
    // 播放动作 动画
    mNeddlePlayAnimator = ObjectAnimator.ofFloat(mNeddleiew, "rotation", -25, 0);
    mNeddlePlayAnimator.setDuration(200);
    mNeddlePlayAnimator.setRepeatMode(ValueAnimator.REVERSE);
    mNeddlePlayAnimator.setRepeatCount(0);
    mNeddlePlayAnimator.setInterpolator(new LinearInterpolator());
    // 暂停播放动作 动画
    mNeddlePauseAnimator = ObjectAnimator.ofFloat(mNeddleiew, "rotation", 0, -25);
    mNeddlePauseAnimator.setDuration(200);
    mNeddlePauseAnimator.setRepeatMode(ValueAnimator.REVERSE);
    mNeddlePauseAnimator.setRepeatCount(0);
    mNeddlePauseAnimator.setInterpolator(new LinearInterpolator());
}

16 Source : WaterView.java
with Apache License 2.0
from xiaohaibin

public void start() {
    if (mAnimator == null) {
        mAnimator = ObjectAnimator.ofFloat(this, "translationY", -6.0f, 6.0f, -6.0f);
        mAnimator.setDuration(3500);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.setRepeatMode(ValueAnimator.RESTART);
        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mAnimator.start();
    } else if (!mAnimator.isStarted()) {
        mAnimator.start();
    }
}

16 Source : PropertyAnimationActivity.java
with Apache License 2.0
from REBOOTERS

private void AlpahAnimation() {
    anim = ObjectAnimator.ofFloat(myView, "alpha", 1.0f, 0.8f, 0.6f, 0.4f, 0.2f, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f);
    anim.setRepeatCount(-1);
    anim.setRepeatMode(ObjectAnimator.REVERSE);
    anim.setDuration(2000);
    anim.start();
}

16 Source : WavePicView.java
with MIT License
from NickKJ

/**
 * 动画
 */
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();
    }
}

16 Source : PulseAnimation.java
with GNU General Public License v3.0
from nextcloud

public void start() {
    if (view == null)
        throw new NullPointerException("View cant be null!");
    scaleDown = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("scaleX", 1.2f), PropertyValuesHolder.ofFloat("scaleY", 1.2f));
    scaleDown.setDuration(duration);
    scaleDown.setRepeatMode(repeatMode);
    scaleDown.setRepeatCount(repeatCount);
    scaleDown.setAutoCancel(true);
    scaleDown.start();
}

16 Source : ClassicHeader.java
with Apache License 2.0
from luckybilly

@Override
public void onInit(boolean horizontal) {
    ViewGroup.LayoutParams layoutParams = getLayoutParams();
    if (horizontal) {
        LayoutInflater.from(getContext()).inflate(R.layout.ssr_clreplacedic_header_footer_horizontal, this);
        if (layoutParams == null) {
            int width = SmartSwipe.dp2px(60, getContext());
            layoutParams = new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.MATCH_PARENT);
        }
    } else {
        LayoutInflater.from(getContext()).inflate(R.layout.ssr_clreplacedic_header_footer, this);
        if (layoutParams == null) {
            int height = SmartSwipe.dp2px(60, getContext());
            layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);
        }
    }
    setLayoutParams(layoutParams);
    Drawable background = getBackground();
    if (background == null) {
        setBackgroundColor(0xFFEEEEEE);
    }
    mProgressImageView = findViewById(R.id.ssr_clreplacedics_progress);
    mProgressImageView.setVisibility(GONE);
    mreplacedleTextView = findViewById(R.id.ssr_clreplacedics_replacedle);
    mreplacedleTextView.setText(R.string.ssr_header_pulling);
    animator = ObjectAnimator.ofFloat(mProgressImageView, "rotation", 0, 3600);
    animator.setDuration(5000);
    animator.setInterpolator(null);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
}

16 Source : ObjAnimSample.java
with Apache License 2.0
from KosmoSakura

/**
 * ObjectAnimator
 */
public void obj() {
    /**
     * 平移
     * translationX、translationY、
     * TranslationX、TranslationY
     */
    ObjectAnimator translationX = ObjectAnimator.ofFloat(view, "translationX", 0, 300);
    // 重复次数
    // 重复1次=动画执行2次
    translationX.setRepeatCount(1);
    // 无限重复
    translationX.setRepeatCount(-1);
    // 重复方式
    // 反向:来回一次
    translationX.setRepeatMode(ValueAnimator.REVERSE);
    /**
     * 透明度
     * alpha、Alpha
     */
    ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f, 0);
    alpha.setRepeatCount(-1);
    /**
     * 旋转
     * rotation,
     * rotationX、rotationY、
     * RotationX、RotationY
     */
    ObjectAnimator rotation = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f, 0);
    alpha.setRepeatCount(-1);
    /**
     * 缩放:原控件大小的倍率
     * scaleX、scaleY
     * ScaleX、ScaleY
     */
    ObjectAnimator scale = ObjectAnimator.ofFloat(view, "scaleX", 0f, 2.2f, 0);
    alpha.setRepeatCount(-1);
    AnimatorSet animSet = new AnimatorSet();
    animSet.playTogether(translationX, alpha);
    animSet.play(scale).after(alpha).with(translationX);
    run(animSet);
}

16 Source : InstagramRecordIndicator.java
with Apache License 2.0
from JessYanCoding

public void playIndicatorAnimation() {
    if (mIndicationrAnimation == null) {
        mIndicationrAnimation = ObjectAnimator.ofFloat(mIndicatorView, "alpha", 1.0f, 0f).setDuration(500);
        mIndicationrAnimation.setRepeatMode(ValueAnimator.REVERSE);
        mIndicationrAnimation.setRepeatCount(ValueAnimator.INFINITE);
    }
    mIndicationrAnimation.start();
}

16 Source : ChatLoadMoreView.java
with Apache License 2.0
from FreddyChen

private ObjectAnimator getHeaderLoadingAnimator() {
    if (mHeaderLoadingAnimator == null) {
        mHeaderLoadingAnimator = ObjectAnimator.ofFloat(mLoadingImageView, CConfig.ANIMATOR_ROTATION, 0.0f, 359.9f);
        mHeaderLoadingAnimator.setDuration(1000);
        mHeaderLoadingAnimator.setInterpolator(new LinearInterpolator());
        mHeaderLoadingAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mHeaderLoadingAnimator.setRepeatMode(ValueAnimator.RESTART);
    }
    return mHeaderLoadingAnimator;
}

16 Source : CustomRenderer.java
with MIT License
from FireZenk

private void setupAnimation() {
    animator = ObjectAnimator.ofFloat(colon, "alpha", 0f, 1f, 0f);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(1000);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    startAnimation();
}

16 Source : ChatHeadOverlayView.java
with BSD 2-Clause "Simplified" License
from Denny966

private void init(Context context) {
    STAMP_SPACING = ChatHeadUtils.dpToPx(context, 20);
    OVAL_RADIUS = ChatHeadUtils.dpToPx(context, 3);
    animator = ObjectAnimator.ofFloat(this, "phase", 0f, -STAMP_SPACING);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setDuration(ANIMATION_DURATION);
}

15 Source : AnimateGradientView.java
with MIT License
from skyfe79

public Animator startInfiniteRotationAnimation(long duration) {
    if (isInEditMode())
        return null;
    animator = ObjectAnimator.ofFloat(this, "angle", 0.0f, 360.0f);
    animator.setDuration(duration);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setRepeatMode(ObjectAnimator.INFINITE);
    animator.setInterpolator(new LinearInterpolator());
    animator.start();
    return animator;
}

15 Source : AnimateGradientView.java
with MIT License
from skyfe79

public Animator startRotateAnimation(long duration, int count) {
    if (isInEditMode())
        return null;
    animator = ObjectAnimator.ofFloat(this, "angle", 0.0f, 360.0f);
    animator.setDuration(duration);
    animator.setRepeatCount(count);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    animator.setInterpolator(new LinearInterpolator());
    animator.start();
    return animator;
}

15 Source : DragCircle.java
with GNU General Public License v3.0
from qiujuer

private void animateCheckedState() {
    AnimatorProperty property = new AnimatorProperty();
    property.mAngle = -360;
    property.mRadius = 1;
    if (mAnimator == null) {
        mAnimator = ObjectAnimator.ofObject(this, ANIM_VALUE, new AnimatorEvaluator(mProperty), new AnimatorProperty(), property);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.setDuration(ANIMATION_DURATION);
        /*
            mAnimator.addListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {

                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    animateCheckedState();
                }

                @Override
                public void onAnimationCancel(Animator animation) {

                }

                @Override
                public void onAnimationRepeat(Animator animation) {

                }
            });
            */
        mAnimator.setRepeatCount(-1);
        mAnimator.setRepeatMode(Animation.RESTART);
    } else {
        mAnimator.setObjectValues(new AnimatorProperty(), property);
    }
    mAnimator.start();
}

15 Source : ClickNumberPickerView.java
with Apache License 2.0
from polok

private void initAnimators() {
    leftPickerTranslationXAnimator = ObjectAnimator.ofFloat(rlCenter, "translationX", -valueViewOffset);
    leftPickerTranslationXAnimator.setInterpolator(new FastOutLinearInInterpolator());
    leftPickerTranslationXAnimator.setRepeatMode(ValueAnimator.REVERSE);
    leftPickerTranslationXAnimator.setRepeatCount(1);
    leftPickerTranslationXAnimator.setDuration(animationOffsetLeftDuration);
    rightPickerTranslationXAnimator = ObjectAnimator.ofFloat(rlCenter, "translationX", valueViewOffset);
    rightPickerTranslationXAnimator.setInterpolator(new FastOutLinearInInterpolator());
    rightPickerTranslationXAnimator.setRepeatMode(ValueAnimator.REVERSE);
    rightPickerTranslationXAnimator.setRepeatCount(1);
    rightPickerTranslationXAnimator.setDuration(animationOffsetRightDuration);
    valueDownChangeAnimator = ObjectAnimator.ofFloat(tvValue, "textSize", valueTextSize, valueMinTextSize);
    valueDownChangeAnimator.setDuration(animationDownDuration);
    valueDownChangeAnimator.setRepeatCount(1);
    valueDownChangeAnimator.setRepeatMode(ValueAnimator.REVERSE);
    valueUpChangeAnimator = ObjectAnimator.ofFloat(tvValue, "textSize", valueTextSize, valueMaxTextSize);
    valueUpChangeAnimator.setDuration(animationUpDuration);
    valueUpChangeAnimator.setRepeatCount(1);
    valueUpChangeAnimator.setRepeatMode(ValueAnimator.REVERSE);
}

15 Source : FirstActivity.java
with Apache License 2.0
from linchupeng

private void playSunAnim() {
    ObjectAnimator anim = ObjectAnimator.ofFloat(splashSun, "rotation", 0f, 360f);
    anim.setRepeatMode(ObjectAnimator.RESTART);
    anim.setRepeatCount(ObjectAnimator.INFINITE);
    anim.setInterpolator(new LinearInterpolator());
    anim.setDuration(30 * 1000);
    anim.start();
}

15 Source : ListViewHighlighter.java
with Apache License 2.0
from Launcher3-dev

private ColorDrawable getHighlightBackground() {
    int color = ColorUtils.setAlphaComponent(Themes.getColorAccent(mListView.getContext()), 26);
    if (mColorAnimated) {
        return new ColorDrawable(color);
    }
    mColorAnimated = true;
    ColorDrawable bg = new ColorDrawable(Color.WHITE);
    ObjectAnimator anim = ObjectAnimator.ofInt(bg, "color", Color.WHITE, color);
    anim.setEvaluator(new ArgbEvaluator());
    anim.setDuration(200L);
    anim.setRepeatMode(ValueAnimator.REVERSE);
    anim.setRepeatCount(4);
    anim.start();
    return bg;
}

15 Source : LoadingFlashView.java
with Apache License 2.0
from jiyouliang

private void initAnimation() {
    mAnimatorSet = new AnimatorSet();
    List<ImageView> imageViewList = Arrays.asList(mLoad1, mLoad2, mLoad3, mLoad4);
    List<Animator> animatorList = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        ObjectAnimator loadAnimator = ObjectAnimator.ofFloat(imageViewList.get(i), "alpha", new float[] { 1.0F, 0.5F }).setDuration(500L);
        loadAnimator.setStartDelay(100 * i);
        loadAnimator.setRepeatMode(ObjectAnimator.REVERSE);
        loadAnimator.setRepeatCount(-1);
        animatorList.add(loadAnimator);
    }
    mAnimatorSet.playTogether(animatorList);
// ObjectAnimator loadAnimator1 = ObjectAnimator.ofFloat(mLoad1, "alpha", new float[]{1.0F, 0.5F}).setDuration(500L);
// ObjectAnimator loadAnimator2 = ObjectAnimator.ofFloat(mLoad2, "alpha", new float[]{1.0F, 0.5F}).setDuration(500L);
// ObjectAnimator loadAnimator3 = ObjectAnimator.ofFloat(mLoad3, "alpha", new float[]{1.0F, 0.5F}).setDuration(500L);
// ObjectAnimator loadAnimator4 = ObjectAnimator.ofFloat(mLoad4, "alpha", new float[]{1.0F, 0.5F}).setDuration(500L);
// loadAnimator1.setStartDelay(0L);
// loadAnimator2.setStartDelay(100L);
// loadAnimator3.setStartDelay(200L);
// loadAnimator4.setStartDelay(300L);
// loadAnimator1.setRepeatMode(ObjectAnimator.REVERSE);
// loadAnimator2.setRepeatMode(ObjectAnimator.REVERSE);
// loadAnimator3.setRepeatMode(ObjectAnimator.REVERSE);
// loadAnimator4.setRepeatMode(ObjectAnimator.REVERSE);
// loadAnimator1.setRepeatCount(-1);
// loadAnimator2.setRepeatCount(-1);
// loadAnimator3.setRepeatCount(-1);
// loadAnimator4.setRepeatCount(-1);
// mAnimatorSet.playTogether(new Animator[]{loadAnimator1, loadAnimator2, loadAnimator3, loadAnimator4});
}

15 Source : PathAnimations.java
with Apache License 2.0
from jiyouliang

private void startAnimator(int checkedId) {
    if (mAnimator != null) {
        mAnimator.cancel();
        mAnimator = null;
    }
    View view = findViewById(R.id.moved_item);
    Path path = mCanvasView.getPath();
    if (path.isEmpty()) {
        return;
    }
    switch(checkedId) {
        case R.id.named_components:
            // Use the named "x" and "y" properties for individual (x, y)
            // coordinates of the Path and set them on the view object.
            // The setX(float) and setY(float) methods are called on view.
            // An int version of this method also exists for animating
            // int Properties.
            mAnimator = ObjectAnimator.ofFloat(view, "x", "y", path);
            break;
        case R.id.property_components:
            // Use two Properties for individual (x, y) coordinates of the Path
            // and set them on the view object.
            // An int version of this method also exists for animating
            // int Properties.
            mAnimator = ObjectAnimator.ofFloat(view, View.X, View.Y, path);
            break;
        case R.id.multi_int:
            // Use a multi-int setter to animate along a Path. The method
            // setCoordinates(int x, int y) is called on this during the animation.
            // Either "setCoordinates" or "coordinates" are acceptable parameters
            // because the "set" can be implied.
            mAnimator = ObjectAnimator.ofMultiInt(this, "setCoordinates", path);
            break;
        case R.id.multi_float:
            // Use a multi-float setter to animate along a Path. The method
            // changeCoordinates(float x, float y) is called on this during the animation.
            mAnimator = ObjectAnimator.ofMultiFloat(this, "changeCoordinates", path);
            break;
        case R.id.named_setter:
            // Use the named "point" property to animate along the Path.
            // There must be a method setPoint(PointF) on the animated object.
            // Because setPoint takes a PointF parameter, no TypeConverter is necessary.
            // In this case, the animated object is PathAnimations.
            mAnimator = ObjectAnimator.ofObject(this, "point", null, path);
            break;
        case R.id.property_setter:
            // Use the POINT_PROPERTY property to animate along the Path.
            // POINT_PROPERTY takes a Point, not a PointF, so the TypeConverter
            // PointFToPointConverter is necessary.
            mAnimator = ObjectAnimator.ofObject(this, POINT_PROPERTY, new PointFToPointConverter(), path);
            break;
    }
    mAnimator.setDuration(10000);
    mAnimator.setRepeatMode(Animation.RESTART);
    mAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.start();
}

15 Source : BlinkingDrawable.java
with GNU General Public License v3.0
from InsightIM

public void blinking() {
    if (alphaAnimator != null) {
        alphaAnimator.cancel();
    }
    alphaAnimator = ObjectAnimator.ofInt(this, "alpha", 255, 0);
    alphaAnimator.setDuration(1000);
    alphaAnimator.setRepeatMode(ValueAnimator.REVERSE);
    alphaAnimator.setRepeatCount(ValueAnimator.INFINITE);
    alphaAnimator.start();
}

15 Source : PlayerActivity.java
with MIT License
from imcloudfloating

private void initAnimator() {
    mAnimator = ObjectAnimator.ofFloat(mAlbumImage, "rotation", 0f, 360f);
    mAnimator.setDuration(30000);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mAnimator.setRepeatMode(ValueAnimator.RESTART);
}

15 Source : HitokotoActivity.java
with Apache License 2.0
from HeYongRui

private void startRotateAnim(View view) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "rotation", 0, 360);
    objectAnimator.setDuration(500);
    objectAnimator.setRepeatMode(ValueAnimator.RESTART);
    objectAnimator.setRepeatCount(ValueAnimator.INFINITE);
    objectAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationRepeat(Animator animation) {
            super.onAnimationRepeat(animation);
            if (mIsLoadDone) {
                animation.cancel();
            }
        }
    });
    objectAnimator.start();
    mIsLoadDone = false;
}

15 Source : PlayActivity.java
with Apache License 2.0
from Dsiner

private void rotationAnimator() {
    mAnimator = ObjectAnimator.ofFloat(iv_album, "rotation", 0f, 360f);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setRepeatMode(ValueAnimator.RESTART);
    mAnimator.setDuration(5000);
    mAnimator.start();
    mAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationCancel(Animator animation) {
            super.onAnimationCancel(animation);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
        // rotationAnimator();
        }
    });
}

15 Source : PercentView.java
with Apache License 2.0
from Demidong

private void setAnimatorProperty(ObjectAnimator animator) {
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.setDuration(4000);
    animator.setInterpolator(new LinearInterpolator());
}

15 Source : CaptureActivity.java
with GNU General Public License v3.0
from Cocos-BCX

private void initAnim() {
    // 扫描线动画1(属性动画可暂停)
    float curTranslationY = scanLine.getTranslationY();
    objectAnimator = ObjectAnimator.ofFloat(scanLine, "translationY", curTranslationY, dp2px(this, 170));
    objectAnimator.setDuration(4000);
    objectAnimator.setInterpolator(new LinearInterpolator());
    objectAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimator.setRepeatMode(ValueAnimator.RESTART);
}

15 Source : RotateView.java
with Apache License 2.0
from Blankj

private void initAnimator() {
    headerAnimator = ObjectAnimator.ofFloat(this, "rotation", 0f, 360f);
    headerAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    headerAnimator.setInterpolator(new LinearInterpolator());
    headerAnimator.setRepeatMode(ObjectAnimator.RESTART);
    headerAnimator.setDuration(1000);
    headerAnimator.start();
}

15 Source : HomeActivity.java
with Apache License 2.0
from androidthings

/**
 * Create an infinite animation to modify the LED brightness.
 */
private ObjectAnimator animateFlicker(Pwm led, long delay) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(led, new BrightnessProperty(), BRIGHTNESS_START, BRIGHTNESS_END).setDuration(DURATION_MS + delay);
    // "Bounce" at each end to create a flicker effect
    animator.setInterpolator(new BounceInterpolator());
    // Cycle through the animation forever
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    return animator;
}

14 Source : WaveHelper.java
with MIT License
from vijanny

private void initAnimation() {
    List<Animator> animators = new ArrayList<>();
    // horizontal animation.
    // wave waves infinitely.
    ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(mWaveView, "waveShiftRatio", 0f, 1f);
    waveShiftAnim.setRepeatCount(ValueAnimator.INFINITE);
    waveShiftAnim.setDuration(1000);
    waveShiftAnim.setInterpolator(new LinearInterpolator());
    animators.add(waveShiftAnim);
    // vertical animation.
    // water level increases from 0 to center of WaveView
    ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(mWaveView, "waterLevelRatio", 0f, 0.5f);
    waterLevelAnim.setDuration(1000);
    waterLevelAnim.setInterpolator(new DecelerateInterpolator());
    animators.add(waterLevelAnim);
    // amplitude animation.
    // wave grows big then grows small, repeatedly
    ObjectAnimator amplitudeAnim = ObjectAnimator.ofFloat(mWaveView, "amplitudeRatio", 0.0001f, 0.05f);
    amplitudeAnim.setRepeatCount(ValueAnimator.INFINITE);
    amplitudeAnim.setRepeatMode(ValueAnimator.REVERSE);
    amplitudeAnim.setDuration(5000);
    amplitudeAnim.setInterpolator(new LinearInterpolator());
    animators.add(amplitudeAnim);
    mAnimatorSet = new AnimatorSet();
    mAnimatorSet.playTogether(animators);
}

14 Source : RippleWrapper.java
with Apache License 2.0
from triline3

public void build() {
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.addRule(CENTER_IN_PARENT, TRUE);
    mAnimatorSet = new AnimatorSet();
    ArrayList<Animator> animators = new ArrayList<>();
    for (int i = 0; i < mRippleAmount; i++) {
        RippleView rippleView = new RippleView(getContext(), mRippleColor);
        addView(rippleView, params);
        ObjectAnimator widthAnimator = ObjectAnimator.ofFloat(rippleView, SCALE_X, 1.0f, 1.318f);
        widthAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        widthAnimator.setRepeatMode(ObjectAnimator.RESTART);
        widthAnimator.setDuration(mRippleDuration);
        widthAnimator.setStartDelay(i * mRippleDelay);
        widthAnimator.setInterpolator(new AccelerateInterpolator());
        animators.add(widthAnimator);
        ObjectAnimator heightAnimator = ObjectAnimator.ofFloat(rippleView, SCALE_Y, 1.0f, 1.318f);
        heightAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        heightAnimator.setRepeatMode(ObjectAnimator.RESTART);
        heightAnimator.setDuration(mRippleDuration);
        heightAnimator.setStartDelay(i * mRippleDelay);
        heightAnimator.setInterpolator(new AccelerateInterpolator());
        animators.add(heightAnimator);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, View.ALPHA, 1.0f, 0f);
        alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
        alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
        alphaAnimator.setDuration(mRippleDuration);
        alphaAnimator.setStartDelay(i * mRippleDelay);
        alphaAnimator.setInterpolator(new AccelerateInterpolator());
        animators.add(alphaAnimator);
    }
    mAnimatorSet.playTogether(animators);
    mAnimatorSet.start();
}

14 Source : AnimateGradientView.java
with MIT License
from skyfe79

public Animator startTransitionAnimation(long duration, int length, FlowDirection direction) {
    if (isInEditMode())
        return null;
    float from;
    float to;
    switch(direction) {
        case Left:
        case Top:
            from = 0.0f;
            to = length * 1000.0f;
            break;
        default:
            from = length * 1000.0f;
            to = 0.0f;
    }
    animator = ObjectAnimator.ofFloat(this, "gradientOffset", from, to);
    animator.setDuration(duration * 1000);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    animator.setInterpolator(new LinearInterpolator());
    animator.start();
    return animator;
}

14 Source : DonateActivity.java
with GNU Affero General Public License v3.0
from Shouheng88

private void initAnimator() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(getBinding().tip, "alpha", 0, 0.66f, 1.0f, 0);
    animator.setDuration(2888);
    animator.setRepeatCount(6);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.start();
}

14 Source : WaveHelper.java
with GNU General Public License v3.0
from qtumproject

private void initAnimation() {
    List<Animator> animators = new ArrayList<>();
    ObjectAnimator waveWidthAnim = ObjectAnimator.ofFloat(mWaveView, "waveLengthRatio", 1f, .8f);
    waveWidthAnim.setRepeatCount(ValueAnimator.INFINITE);
    waveWidthAnim.setRepeatMode(ValueAnimator.REVERSE);
    waveWidthAnim.setDuration(5000);
    waveWidthAnim.setInterpolator(new LinearInterpolator());
    animators.add(waveWidthAnim);
    ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(mWaveView, "waveShiftRatio", 0f, 1f);
    waveShiftAnim.setRepeatCount(ValueAnimator.INFINITE);
    waveShiftAnim.setDuration(10000);
    waveShiftAnim.setInterpolator(new LinearInterpolator());
    animators.add(waveShiftAnim);
    ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(mWaveView, "waterLevelRatio", .4f, .5f);
    waterLevelAnim.setDuration(10000);
    waterLevelAnim.setInterpolator(new DecelerateInterpolator());
    waterLevelAnim.setRepeatCount(ValueAnimator.INFINITE);
    waterLevelAnim.setRepeatMode(ValueAnimator.REVERSE);
    animators.add(waterLevelAnim);
    ObjectAnimator amplitudeAnim = ObjectAnimator.ofFloat(mWaveView, "amplitudeRatio", 0.05f, 0.12f);
    amplitudeAnim.setRepeatCount(ValueAnimator.INFINITE);
    amplitudeAnim.setRepeatMode(ValueAnimator.REVERSE);
    amplitudeAnim.setDuration(10000);
    amplitudeAnim.setInterpolator(new LinearInterpolator());
    animators.add(amplitudeAnim);
    mAnimatorSet = new AnimatorSet();
    mAnimatorSet.playTogether(animators);
}

14 Source : CircleProgressView.java
with Apache License 2.0
from lulululbj

public void animateIndeterminate(int durationOneCircle, TimeInterpolator interpolator) {
    animator = ObjectAnimator.ofFloat(this, "startAngle", getStartAngle(), getStartAngle() + 360);
    if (interpolator != null)
        animator.setInterpolator(interpolator);
    animator.setDuration(durationOneCircle);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setRepeatMode(ValueAnimator.RESTART);
    animator.start();
}

14 Source : FloatingLabelEditText.java
with Apache License 2.0
from james602152002

private void startErrorAnimation() {
    final float error_length = errorPaint.measureText(error.toString());
    int w = View.MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    int h = View.MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    measure(w, h);
    final int width = getWidth() > 0 ? getWidth() : getMeasuredWidth();
    int max_length_width = 0;
    if (show_max_length) {
        max_length_text_width = measureTextMaxLength();
    }
    if (error_length > width - (error_horizontal_margin << 1) - max_length_width) {
        error_percentage = 0;
        if (errorAnimator == null)
            errorAnimator = ObjectAnimator.ofFloat(this, "error_percentage", 0, 1);
        errorAnimator.setRepeatCount(ValueAnimator.INFINITE);
        errorAnimator.setRepeatMode(ValueAnimator.RESTART);
        errorAnimator.setStartDelay(ANIM_DURATION);
        short duration = (short) (ERROR_ANIM_DURATION_PER_WIDTH * error_length / width);
        if (duration < 0)
            duration = 8000;
        errorAnimator.setDuration(duration);
        post(new Runnable() {

            @Override
            public void run() {
                if (errorAnimator != null)
                    errorAnimator.start();
            }
        });
    } else {
        error_percentage = 0;
    }
}

14 Source : SunsetFragment.java
with Apache License 2.0
from InnoFang

private void startSunPulsateAnimation() {
    ObjectAnimator sunPulsateAnimator = ObjectAnimator.ofObject(mSunView, "backgroundColor", new ArgbEvaluator(), mColdSunColor, mHeatSunColor).setDuration(1000);
    sunPulsateAnimator.setRepeatMode(ValueAnimator.REVERSE);
    sunPulsateAnimator.setRepeatCount(ValueAnimator.INFINITE);
    sunPulsateAnimator.start();
}

14 Source : CatLoadingDialog.java
with Apache License 2.0
from HeYongRui

private void startRotateAnim() {
    if (mAnimatorSet != null && mAnimatorSet.isRunning())
        return;
    float rotation = mouse.getRotation();
    rotation = rotation > 720 ? rotation % 720 : rotation;
    ObjectAnimator mouseRotationAnim = ObjectAnimator.ofFloat(mouse, "rotation", 360f + rotation, rotation);
    // 根据抓住老鼠的次数动态设置旋转时间,提升游戏难度
    long duration = 2000 - mCatchTime * 400;
    // 控制最快时间为400毫秒
    duration = duration < 400 ? 400 : duration;
    // 设置动画时间
    mouseRotationAnim.setDuration(duration);
    // 动画时间线性渐变
    mouseRotationAnim.setInterpolator(new LinearInterpolator());
    mouseRotationAnim.setRepeatCount(ObjectAnimator.INFINITE);
    mouseRotationAnim.setRepeatMode(ObjectAnimator.RESTART);
    ObjectAnimator leftEyeRotationAnim = mouseRotationAnim.clone();
    leftEyeRotationAnim.setTarget(eyeLeft);
    ObjectAnimator rightEyeRotationAnim = mouseRotationAnim.clone();
    rightEyeRotationAnim.setTarget(eyeRight);
    mAnimatorSet = new AnimatorSet();
    mouseRotationAnim.addUpdateListener(valueAnimator -> {
        mRotateAngle = (float) valueAnimator.getAnimatedValue();
        updateEyelidHeight(mRotateAngle);
    });
    mAnimatorSet.playTogether(mouseRotationAnim, leftEyeRotationAnim, rightEyeRotationAnim);
    mAnimatorSet.start();
}

14 Source : RxWaveHelper.java
with Apache License 2.0
from hexingbo

private void initAnimation() {
    List<Animator> animators = new ArrayList<>();
    // horizontal animation.
    // wave waves infinitely.
    ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(mWaveView, "waveShiftRatio", 0f, 1f);
    waveShiftAnim.setRepeatCount(ValueAnimator.INFINITE);
    waveShiftAnim.setDuration(1000);
    waveShiftAnim.setInterpolator(new LinearInterpolator());
    animators.add(waveShiftAnim);
    // vertical animation.
    // water level increases from 0 to center of RxWaveView
    ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(mWaveView, "waterLevelRatio", 0f, 0.5f);
    waterLevelAnim.setDuration(10000);
    waterLevelAnim.setInterpolator(new DecelerateInterpolator());
    animators.add(waterLevelAnim);
    // amplitude animation.
    // wave grows big then grows small, repeatedly
    ObjectAnimator amplitudeAnim = ObjectAnimator.ofFloat(mWaveView, "amplitudeRatio", 0.0001f, 0.05f);
    amplitudeAnim.setRepeatCount(ValueAnimator.INFINITE);
    amplitudeAnim.setRepeatMode(ValueAnimator.REVERSE);
    amplitudeAnim.setDuration(5000);
    amplitudeAnim.setInterpolator(new LinearInterpolator());
    animators.add(amplitudeAnim);
    mAnimatorSet = new AnimatorSet();
    mAnimatorSet.playTogether(animators);
}

14 Source : BottomFragment.java
with Apache License 2.0
from HelloChenJinJun

private void startAnimation() {
    mRotateAnimator = ObjectAnimator.ofFloat(album, "rotation", 0f, 360f);
    mRotateAnimator.setDuration(10000);
    mRotateAnimator.setInterpolator(new LinearInterpolator());
    mRotateAnimator.setRepeatMode(ValueAnimator.RESTART);
    mRotateAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mRotateAnimator.start();
}

14 Source : CLoadingDialog.java
with Apache License 2.0
from FreddyChen

private void startLoadingAnimator() {
    mLoadingAnimator = ObjectAnimator.ofFloat(mLoadingImageView, CConfig.ANIMATOR_ROTATION, 0.0f, 359.9f);
    mLoadingAnimator.setRepeatCount(ValueAnimator.INFINITE);
    mLoadingAnimator.setRepeatMode(ValueAnimator.RESTART);
    mLoadingAnimator.setDuration(1500);
    mLoadingAnimator.setInterpolator(new LinearInterpolator());
    mLoadingAnimator.start();
}

14 Source : DotsTextView.java
with Apache License 2.0
from Equalzys

private ObjectAnimator createDotJumpAnimator(JumpingSpan jumpingSpan, long delay) {
    ObjectAnimator jumpAnimator = ObjectAnimator.ofFloat(jumpingSpan, "translationY", 0, -jumpHeight);
    jumpAnimator.setEvaluator(new SinTypeEvaluator());
    jumpAnimator.setDuration(period);
    jumpAnimator.setStartDelay(delay);
    jumpAnimator.setRepeatCount(ValueAnimator.INFINITE);
    jumpAnimator.setRepeatMode(ValueAnimator.RESTART);
    return jumpAnimator;
}

14 Source : RecordFragment.java
with Apache License 2.0
from Arjun-sna

private void initViews(View recordView) {
    chronometer = recordView.findViewById(R.id.chronometer);
    audioVisualization = recordView.findViewById(R.id.visualizer_view);
    mSettingsButton = recordView.findViewById(R.id.settings_btn);
    mPlayListBtn = recordView.findViewById(R.id.play_list_btn);
    mRecordButton = recordView.findViewById(R.id.btnRecord);
    mPauseButton = recordView.findViewById(R.id.btnPause);
    // hide pause button before recording starts
    mPauseButton.setVisibility(View.GONE);
    alphaAnimator = ObjectAnimator.ofObject(chronometer, "alpha", new FloatEvaluator(), 0.2f);
    alphaAnimator.setRepeatMode(ValueAnimator.REVERSE);
    alphaAnimator.setRepeatCount(ValueAnimator.INFINITE);
    audioRecordPresenter.onViewInitialised();
}

14 Source : NoInternetDialog.java
with Apache License 2.0
from appwise-labs

private void animateWifi() {
    wifiAnimator = ObjectAnimator.ofFloat(wifiIndicator, "alpha", 0f, 0.5f);
    wifiAnimator.setDuration(1500);
    wifiAnimator.setRepeatMode(ValueAnimator.RESTART);
    wifiAnimator.setRepeatCount(ValueAnimator.INFINITE);
    wifiAnimator.start();
}

13 Source : BottomMusicView.java
with Apache License 2.0
from zion223

private void initView() {
    View rootView = LayoutInflater.from(mContext).inflate(R.layout.bottom_view, this);
    rootView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // 跳到音乐播放Activireplacedy
            MusicPlayerActivity.start((Activity) mContext);
        }
    });
    mLeftView = rootView.findViewById(R.id.album_view);
    // 属性动画 旋转动画
    mRotateAnimator = ObjectAnimator.ofFloat(mLeftView, View.ROTATION.getName(), 0f, 360f);
    mRotateAnimator.setDuration(10000);
    mRotateAnimator.setInterpolator(new LinearInterpolator());
    // 循环模式
    mRotateAnimator.setRepeatMode(ObjectAnimator.RESTART);
    mRotateAnimator.setRepeatCount(ObjectAnimator.INFINITE);
    mreplacedleView = rootView.findViewById(R.id.audio_name_view);
    mAlbumView = rootView.findViewById(R.id.audio_album_view);
    mPlayView = rootView.findViewById(R.id.play_view);
    mPlayView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // 处理播放暂停事件
            AudioController.getInstance().playOrPause();
        }
    });
    mRightView = rootView.findViewById(R.id.show_list_view);
    mRightView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
        // 显示音乐列表对话框
        // MusicListDialog dialog = new MusicListDialog(mContext);
        // dialog.show();
        }
    });
}

13 Source : SmileView.java
with Apache License 2.0
from zenglingchao

public void objectX(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10.0f, 0.0f, 10.0f, 0.0f, -10.0f, 0.0f, 10.0f, 0);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    // animator.setRepeatCount(1);
    animator.setDuration(1500);
    animator.start();
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            // 执行回弹动画
            setBackUp();
        }
    });
}

See More Examples