Class DefaultInterpolator

java.lang.Object
com.github.weisj.jsvg.animation.interpolation.DefaultInterpolator
All Implemented Interfaces:
FloatInterpolator, FloatListInterpolator, PaintInterpolator, TransformInterpolator

public final class DefaultInterpolator extends Object implements FloatInterpolator, FloatListInterpolator, PaintInterpolator, TransformInterpolator
  • Field Details

  • Constructor Details

  • Method Details

    • interpolate

      public float interpolate(float initial, float a, float b, float progress)
      Specified by:
      interpolate in interface FloatInterpolator
    • ensureCacheCapacity

      private static float @NotNull [] ensureCacheCapacity(float @Nullable [] cache, int length)
    • arrayLerp

      private static float @NotNull [] arrayLerp(float @Nullable [] cache, float @NotNull [] from, float @Nullable [] to, float progress)
    • saxpy

      private static float @NotNull [] saxpy(float @Nullable [] cache, float @NotNull [] b, float @Nullable [] x, float a)
      This method is used to calculate the result of the following operation: result_i = a * x_i + b_i
      • If b_i is shorter than a_i, b_i is repeated.
      • If b_i is longer than a_i, the extra values are ignored.
    • interpolate

      public float @NotNull [] interpolate(float @NotNull [] initial, float @NotNull [] a, float @Nullable [] b, float progress, float @Nullable [] cache)
      Specified by:
      interpolate in interface FloatListInterpolator
    • extractColor

      @Nullable private static @Nullable RGBColor extractColor(@NotNull @NotNull SVGPaint p)
    • interpolate

      @NotNull public @NotNull SVGPaint interpolate(@NotNull @NotNull SVGPaint initial, @NotNull @NotNull SVGPaint a, @NotNull @NotNull SVGPaint b, float progress)
      Specified by:
      interpolate in interface PaintInterpolator
    • discreteAnimation

      private SVGPaint discreteAnimation(@NotNull @NotNull SVGPaint initial, @NotNull @NotNull SVGPaint a, @NotNull @NotNull SVGPaint b, float progress)
    • interpolate

      @NotNull public @NotNull AffineTransform interpolate(@NotNull @NotNull MeasureContext context, @NotNull @NotNull TransformValue initial, @NotNull @NotNull TransformPart a, @NotNull @NotNull TransformPart b, float progress)
      Specified by:
      interpolate in interface TransformInterpolator