private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) { ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale); animator.setInterpolator(new LinearOutSlowInInterpolator()); animator.setStartDelay(DELAY_COLOR_CHANGE + durationOffset); animator.start(); }
@Override public void setAnimation(View view) { ObjectAnimator rotationX = ObjectAnimator.ofFloat(view, "rotationX", 10, 0f).setDuration(150); rotationX.setStartDelay(200); animatorSet.playTogether( ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 0.8f).setDuration(350), ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.8f).setDuration(350), // ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.5f).setDuration(350), ObjectAnimator.ofFloat(view, "rotationX", 0f, 10).setDuration(200), rotationX, ObjectAnimator.ofFloat(view, "translationY", 0, -0.1f * mDisplayMetrics.heightPixels).setDuration(350) ); } }
@Override public void setAnimation(View view) { ObjectAnimator rotationX = ObjectAnimator.ofFloat(view, "rotationX", 10, 0f).setDuration(150); rotationX.setStartDelay(200); animatorSet.playTogether( ObjectAnimator.ofFloat(view, "scaleX", 0.8f, 1.0f).setDuration(350), ObjectAnimator.ofFloat(view, "scaleY", 0.8f, 1.0f).setDuration(350), // ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.5f).setDuration(350), ObjectAnimator.ofFloat(view, "rotationX", 0f, 10).setDuration(200), rotationX, ObjectAnimator.ofFloat(view, "translationY", -0.1f * mDisplayMetrics.heightPixels, 0).setDuration(350) ); } }
private void animateShutter() { vShutter.setVisibility(View.VISIBLE); vShutter.setAlpha(0.f); ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f); alphaInAnim.setDuration(100); alphaInAnim.setStartDelay(100); alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f); alphaOutAnim.setDuration(200); alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playSequentially(alphaInAnim, alphaOutAnim); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { vShutter.setVisibility(View.GONE); } }); animatorSet.start(); }
private void animateForegroundColor(@ColorInt final int targetColor) { ObjectAnimator animator = ObjectAnimator.ofInt(this, FOREGROUND_COLOR, Color.TRANSPARENT, targetColor); animator.setEvaluator(new ArgbEvaluator()); animator.setStartDelay(DELAY_COLOR_CHANGE); animator.start(); }
ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(holder.vBgLike, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
public void setVisibilityWithAnimation(final int visibility, int delayIndex) { if (visibility == View.VISIBLE && getVisibility() != View.VISIBLE) { setAlpha(0); setVisibility(visibility); if (null != alphaAnimator) { alphaAnimator.cancel(); } alphaAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f); alphaAnimator.setDuration(360); alphaAnimator.setStartDelay(delayIndex * 200); alphaAnimator.start(); } } }
@Override protected Animator createSoftwareEnter(boolean fast) { // Bounded ripples don't have enter animations. if (mIsBounded) { return null; } final int duration = (int) (1000 * Math.sqrt(mTargetRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5); final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1); AnimatorsCompat.setAutoCancel(tweenRadius); // tweenRadius.setAutoCancel(true); tweenRadius.setDuration(duration); tweenRadius.setInterpolator(LINEAR_INTERPOLATOR); tweenRadius.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator tweenOrigin = ObjectAnimator.ofFloat(this, TWEEN_ORIGIN, 1); AnimatorsCompat.setAutoCancel(tweenOrigin); // tweenOrigin.setAutoCancel(true); tweenOrigin.setDuration(duration); tweenOrigin.setInterpolator(LINEAR_INTERPOLATOR); tweenOrigin.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1); AnimatorsCompat.setAutoCancel(opacity); // opacity.setAutoCancel(true); opacity.setDuration(OPACITY_ENTER_DURATION_FAST); opacity.setInterpolator(LINEAR_INTERPOLATOR); final AnimatorSet set = new AnimatorSet(); set.play(tweenOrigin).with(tweenRadius).with(opacity); return set; }
fade.setDuration(rippleFadeDuration); fade.setInterpolator(new AccelerateInterpolator()); fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY); fade.setStartDelay(0); rippleAnimator.play(fade); } else {
ObjectAnimator textAnimator = ObjectAnimator.ofPropertyValuesHolder(textView, holderA, holderYm).setDuration(1000); textAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); textAnimator.setStartDelay(800);
if (!run.startVisible) { drawable.setAlpha(TRANSPARENT); fade.setStartDelay((duration + startDelay) / 2); } else { fade.setStartDelay(startDelay); SwitchDrawable.ALPHA, OPAQUE, OPACITY_MID_TRANSITION, OPAQUE); fade.setStartDelay(startDelay); fade.setDuration(duration + startDelay); fade.setInterpolator(linearInterpolator);
ObjectAnimator monthDayAnim = Utils.getPulseAnimator(mMonthAndDayView, 0.9F, 1.05F); if (mDelayAnimation) { monthDayAnim.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; ObjectAnimator yearAnim = Utils.getPulseAnimator(mYearView, 0.85F, 1.1F); if (mDelayAnimation) { yearAnim.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false;
pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
ObjectAnimator scaleYArrowAnim = ViewPropertyObjectAnimator.animate(mLeftAction).scaleY(1.0f).get(); ObjectAnimator fadeArrowAnim = ViewPropertyObjectAnimator.animate(mLeftAction).alpha(1.0f).get(); transXArrowAnim.setStartDelay(150); scaleXArrowAnim.setStartDelay(150); scaleYArrowAnim.setStartDelay(150); fadeArrowAnim.setStartDelay(150);
pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false;
1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false;
private ObjectAnimator create(View target, String propertyName, int repeatCount, long delay, float from, float to) { ObjectAnimator animator = ObjectAnimator.ofFloat(target, propertyName, from, to); animator.setRepeatCount(repeatCount); animator.setRepeatMode(ObjectAnimator.RESTART); animator.setStartDelay(delay); return animator; }
/** * ObjectAnimator usage * * @param b * @return */ public ObjectAnimator getObjectAnimator(boolean b) { if (b) { ObjectAnimator bgColorAnimator = ObjectAnimator.ofArgb(mPuppet, "backgroundColor", 0xff009688, 0xff795548); bgColorAnimator.setRepeatCount(1); bgColorAnimator.setDuration(3000); bgColorAnimator.setRepeatMode(ValueAnimator.REVERSE); bgColorAnimator.setStartDelay(0); return bgColorAnimator; } else { ObjectAnimator rotationXAnimator = ObjectAnimator.ofFloat(mPuppet, "rotationX", 0f, 360f); rotationXAnimator.setRepeatCount(1); rotationXAnimator.setDuration(3000); rotationXAnimator.setRepeatMode(ValueAnimator.REVERSE); return rotationXAnimator; } }