@use "sass:math";

@mixin curvedPath($path_array, $n, $animationName) {
  $switcher: true;
  @keyframes #{$animationName + xAxis} {
    @for $i from 0 to $n {
      #{(math.div(100, ($n - 1)) * $i) + '%'} {
        @if ($switcher) {
          $switcher: false;
          animation-timing-function: ease-in;
        } @else {
          $switcher: true;
          animation-timing-function: ease-out;
        }
        transform: translateX(#{nth(nth($path_array, ($i + 1)), 1)});
      }
    }
  }
  $switcher: true;
  @keyframes #{$animationName + yAxis} {
    @for $i from 0 to $n {
      #{(math.div(100, ($n - 1)) * $i) + '%'} {
        @if ($switcher) {
          $switcher: false;
          animation-timing-function: ease-out;
        } @else {
          $switcher: true;
          animation-timing-function: ease-in;
        }
        transform: translateY(#{nth(nth($path_array, ($i + 1)), 2)});
      }
    }
  }
}
