androidx.core.view.animation.PathInterpolatorCompat Java Examples

The following examples show how to use androidx.core.view.animation.PathInterpolatorCompat. 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: ObjectDotAnimator.java    From mlkit-material-android with Apache License 2.0 5 votes vote down vote up
ObjectDotAnimator(final GraphicOverlay graphicOverlay) {
  ValueAnimator dotScaleUpAnimator =
      ValueAnimator.ofFloat(0f, 1.3f).setDuration(DURATION_DOT_SCALE_UP_MS);
  dotScaleUpAnimator.setInterpolator(new FastOutSlowInInterpolator());
  dotScaleUpAnimator.addUpdateListener(
      animation -> {
        radiusScale = (float) animation.getAnimatedValue();
        graphicOverlay.postInvalidate();
      });

  ValueAnimator dotScaleDownAnimator =
      ValueAnimator.ofFloat(1.3f, 1f).setDuration(DURATION_DOT_SCALE_DOWN_MS);
  dotScaleDownAnimator.setStartDelay(START_DELAY_DOT_SCALE_DOWN_MS);
  dotScaleDownAnimator.setInterpolator(PathInterpolatorCompat.create(0.4f, 0f, 0f, 1f));
  dotScaleDownAnimator.addUpdateListener(
      animation -> {
        radiusScale = (float) animation.getAnimatedValue();
        graphicOverlay.postInvalidate();
      });

  ValueAnimator dotFadeInAnimator =
      ValueAnimator.ofFloat(0f, 1f).setDuration(DURATION_DOT_FADE_IN_MS);
  dotFadeInAnimator.addUpdateListener(
      animation -> {
        alphaScale = (float) animation.getAnimatedValue();
        graphicOverlay.postInvalidate();
      });

  animatorSet = new AnimatorSet();
  animatorSet.playTogether(dotScaleUpAnimator, dotScaleDownAnimator, dotFadeInAnimator);
}
 
Example #2
Source File: ContainerTransformConfigurationHelper.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
CustomCubicBezier(float controlX1, float controlY1, float controlX2, float controlY2) {
  this.controlX1 = controlX1;
  this.controlY1 = controlY1;
  this.controlX2 = controlX2;
  this.controlY2 = controlY2;

  this.interpolator = PathInterpolatorCompat.create(controlX1, controlY1, controlX2, controlY2);
}