export function interpolateStroke()

in src/lib/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js [53:79]


export function interpolateStroke(
  strokeA,
  strokeB,
  interpolateColors,
  interpolateNumbers,
) {
  const colorInterpolator = interpolateColors(
    strokeA?.color ?? "transparent",
    strokeB?.color ?? "transparent",
  )
  const opacityInterpolator = interpolateNumbers(
    strokeA?.opacity ?? 1,
    strokeB?.opacity ?? 1,
  )
  const widthInterpolator = interpolateNumbers(
    strokeA?.width ?? 1,
    strokeB?.width ?? 1,
  )

  return (t) => {
    return new Stroke({
      color: colorInterpolator(t),
      opacity: opacityInterpolator(t),
      width: widthInterpolator(t),
    })
  }
}