/*
 *  Usage:
 *
      <div class="sk-rotating-plane"></div>
 *
 */
@import "../variables";

$spinkit-rotating-plane-width: $spinkit-size;
$spinkit-rotating-plane-height: $spinkit-size;
$spinkit-rotating-plane-margin: $spinkit-spinner-margin;
$spinkit-rotating-plane-background-color: $spinkit-spinner-color;
$spinkit-rotating-plane-animation-duration: 1.2s !default;
$spinkit-rotating-plane-css-export: true !default;

@keyframes sk-rotatePlane {
  0% {
    transform: perspective(120px) rotateX(0deg) rotateY(0deg);
  } 50% {
    transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
  } 100% {
    transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
  }
}

@mixin sk-rotating-plane-size(
  $width: $spinkit-rotating-plane-width,
  $height: $spinkit-rotating-plane-height
) {
  width: $width;
  height: $height;
}

@mixin sk-rotating-plane-color(
  $color: $spinkit-rotating-plane-background-color
) {
  background-color: $color;
}

@mixin sk-rotating-plane-style(
  $width: $spinkit-rotating-plane-width,
  $height: $spinkit-rotating-plane-height,
  $color: $spinkit-rotating-plane-background-color,
  $margin: $spinkit-rotating-plane-margin
) {
  margin: $margin;

  @include sk-rotating-plane-size(
    $width: $width,
    $height: $height
  );

  @include sk-rotating-plane-color(
    $color: $color
  );
}

@mixin sk-rotating-plane(
  $width: $spinkit-rotating-plane-width,
  $height: $spinkit-rotating-plane-height,
  $color: $spinkit-rotating-plane-background-color,
  $margin: $spinkit-rotating-plane-margin,
  $duration: $spinkit-rotating-plane-animation-duration
) {
  animation: sk-rotatePlane #{$duration} infinite ease-in-out;

  @include sk-rotating-plane-style(
    $width: $width,
    $height: $height,
    $color: $color,
    $margin: $margin
  );
}

@if ($spinkit-rotating-plane-css-export) {
  .sk-rotating-plane {
    @include sk-rotating-plane;
  }
}
