Java Code Examples for android.animation.ValueAnimator#setStartDelay()
The following examples show how to use
android.animation.ValueAnimator#setStartDelay() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgressIndicatorView.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: DownloadProgressButton.java From DownloadProgressButton with Apache License 2.0 | 6 votes |
public ArrayList<ValueAnimator> createBallJumpAnimators() { ArrayList<ValueAnimator> animators = new ArrayList<>(); int[] delays = new int[]{70, 140, 210}; for (int i = 0; i < 3; i++) { final int index = i; ValueAnimator scaleAnim = ValueAnimator.ofFloat(mTextBottomBorder, mTextBottomBorder - mBallRadius * 2, mTextBottomBorder); 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(); } }); animators.add(scaleAnim); } return animators; }
Example 3
Source File: BallGridBeatIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 4
Source File: LineScalePulseOutRapidIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 5
Source File: BallPulseIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 6
Source File: BallPulseSyncIndicator.java From LRecyclerView with Apache License 2.0 | 6 votes |
@Override public ArrayList<ValueAnimator> onCreateAnimators() { ArrayList<ValueAnimator> 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]); addUpdateListener(scaleAnim,new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { translateYFloats[index] = (float) animation.getAnimatedValue(); postInvalidate(); } }); animators.add(scaleAnim); } return animators; }
Example 7
Source File: LineScalePartyIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 8
Source File: LineScaleIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 9
Source File: TwinFishesSpinner.java From mkloader with Apache License 2.0 | 6 votes |
@Override public void setUpAnimation() { for (int i = 0; i < numberOfCircle; i++) { final int index = i; ValueAnimator fadeAnimator = ValueAnimator.ofFloat(0, 360); fadeAnimator.setRepeatCount(ValueAnimator.INFINITE); fadeAnimator.setDuration(1700); fadeAnimator.setStartDelay((index >= 5 ? index - 5 : index) * 100); fadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rotates[index] = (float)animation.getAnimatedValue(); if (invalidateListener != null) { invalidateListener.reDraw(); } } }); fadeAnimator.start(); } }
Example 10
Source File: BallPulseSyncIndicator.java From LazyRecyclerAdapter with MIT License | 6 votes |
@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; }
Example 11
Source File: ElevationAnimationDemoFragment.java From material-components-android with Apache License 2.0 | 5 votes |
private void startTranslationZAnimation( View view, MaterialShapeDrawable materialShapeDrawable, float maxTranslationZ) { ValueAnimator animator = ValueAnimator.ofFloat(0, maxTranslationZ); animator.setDuration(ANIMATION_DURATION_MILLIS); animator.setStartDelay(ANIMATION_START_DELAY_MILLIS); animator.setRepeatMode(ValueAnimator.RESTART); animator.setRepeatCount(ValueAnimator.INFINITE); animator.addUpdateListener( animation -> setTranslationZ(view, materialShapeDrawable, (float) animation.getAnimatedValue())); animator.start(); }
Example 12
Source File: ChildClippingFrameLayout.java From OmegaRecyclerView with MIT License | 5 votes |
public void animateClipAboveDecreasing(float decreaseTarget, long duration, long delay) { if (mClipPath == null) return; ValueAnimator valueAnimator = ValueAnimator.ofFloat(mClipHeightAbove, mClipHeightAbove - decreaseTarget) .setDuration(duration); valueAnimator.setStartDelay(delay); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mClipHeightAbove = (float) animation.getAnimatedValue(); updateClip(); requestLayout(); } }); valueAnimator.start(); }
Example 13
Source File: SetNumberActivity.java From weMessage with GNU Affero General Public License v3.0 | 5 votes |
private void startTextSizeAnimation(final TextView view, long startDelay, long duration, float startSize, float endSize){ ValueAnimator textSizeAnimator = ValueAnimator.ofFloat(startSize, endSize); textSizeAnimator.setDuration(duration); textSizeAnimator.setStartDelay(startDelay); textSizeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { view.setTextSize((float) valueAnimator.getAnimatedValue()); } }); textSizeAnimator.start(); }
Example 14
Source File: LoadingView.java From TigerVideo with Apache License 2.0 | 5 votes |
private void createBallAnimator(Ball ball, int startDelay) { ValueAnimator valueAnimator = new ValueAnimator(); valueAnimator.setFloatValues(mMinRadius, mMaxRadius); valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); valueAnimator.setDuration(mDuration); valueAnimator.addUpdateListener(new BallUpdateListener(ball)); valueAnimator.setRepeatMode(ValueAnimator.REVERSE); valueAnimator.setRepeatCount(ValueAnimator.INFINITE); valueAnimator.setStartDelay(startDelay); mBallAnimators.add(valueAnimator); valueAnimator.start(); }
Example 15
Source File: QzoneRefreshHeader.java From LRecyclerView with Apache License 2.0 | 5 votes |
private void refreshRest() { ValueAnimator animator = ValueAnimator.ofFloat(mRefreshView.getTranslationY(), mRefreshHideTranslationY); animator.setStartDelay(60); animator.setDuration(300).start(); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { if (mRefreshView.getTranslationY() == mRefreshHideTranslationY) { animation.cancel(); } else { mRefreshView.setTranslationY((Float) animation.getAnimatedValue()); } } }); }
Example 16
Source File: CircularSplashView.java From HaiNaBaiChuan with Apache License 2.0 | 5 votes |
public void startAnim() { RectF startRect = new RectF(targetSize.centerX(), targetSize.centerY(), targetSize.centerX(), targetSize.centerY()); ValueAnimator rectSize = ValueAnimator.ofObject(new RectFEvaluator(), startRect, targetSize); rectSize.setDuration(animDuration); rectSize.setInterpolator(new QuintOut()); rectSize.setStartDelay(startDelay); rectSize.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { drawingRect = (RectF) animation.getAnimatedValue(); invalidate(); } }); rectSize.start(); }
Example 17
Source File: InsightsAnimatorSetFactory.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private static @Nullable Animator createLottieAnimator(@Nullable UpdateListener updateListener) { if (updateListener == null) return null; final ValueAnimator lottieAnimator = ValueAnimator.ofFloat(0, 1f); lottieAnimator.setStartDelay(ANIMATION_START_DELAY); lottieAnimator.setDuration(LOTTIE_ANIMATION_DURATION); lottieAnimator.addUpdateListener(animation -> updateListener.onUpdate((float) animation.getAnimatedValue())); return lottieAnimator; }
Example 18
Source File: CircularSplashView.java From Depth with MIT License | 5 votes |
public void startAnim() { RectF startRect = new RectF(targetSize.centerX(), targetSize.centerY(), targetSize.centerX(), targetSize.centerY()); ValueAnimator rectSize = ValueAnimator.ofObject(new RectFEvaluator(), startRect, targetSize); rectSize.setDuration(animDuration); rectSize.setInterpolator(new QuintOut()); rectSize.setStartDelay(startDelay); rectSize.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { drawingRect = (RectF) animation.getAnimatedValue(); invalidate(); } }); rectSize.start(); }
Example 19
Source File: SampleActivity.java From CompositionAvatar with MIT License | 5 votes |
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; }
Example 20
Source File: TextSelectionHint.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void show() { AndroidUtilities.cancelRunOnUIThread(dismissTunnable); if (a != null) { a.removeAllListeners(); a.cancel(); } if (getMeasuredHeight() == 0 || getMeasuredWidth() == 0) { showOnMeasure = true; return; } showing = true; setVisibility(View.VISIBLE); prepareProgress = 0; enterValue = 0; currentStart = start; currentEnd = end; startOffsetValue = 1f; endOffsetValue = 1f; invalidate(); ValueAnimator prepareAnimation = ValueAnimator.ofFloat(0, 1f); prepareAnimation.addUpdateListener(animation -> { prepareProgress = (float) animation.getAnimatedValue(); invalidate(); }); prepareAnimation.setDuration(210); prepareAnimation.setInterpolator(new DecelerateInterpolator()); ValueAnimator enterAnimation = ValueAnimator.ofFloat(0, 1f); enterAnimation.addUpdateListener(animation -> { enterValue = (float) animation.getAnimatedValue(); invalidate(); }); enterAnimation.setStartDelay(600); enterAnimation.setDuration(250); ValueAnimator moveStart = ValueAnimator.ofFloat(1f, 0f); moveStart.setStartDelay(500); moveStart.addUpdateListener(animation -> { startOffsetValue = (float) animation.getAnimatedValue(); currentStart = (int) (animateToStart + ((start - animateToStart) * startOffsetValue)); invalidate(); }); moveStart.setInterpolator(CubicBezierInterpolator.EASE_OUT); moveStart.setDuration(500); ValueAnimator moveEnd = ValueAnimator.ofFloat(1f, 0f); moveEnd.setStartDelay(400); moveEnd.addUpdateListener(animation -> { endOffsetValue = (float) animation.getAnimatedValue(); currentEnd = animateToEnd + (int) Math.ceil((end - animateToEnd) * endOffsetValue); invalidate(); }); moveEnd.setInterpolator(CubicBezierInterpolator.EASE_OUT); moveEnd.setDuration(900); AnimatorSet set = new AnimatorSet(); set.playSequentially( prepareAnimation, enterAnimation, moveStart, moveEnd ); a = set; a.start(); AndroidUtilities.runOnUIThread(dismissTunnable, 5000); }