如何从css动画剪辑路径中删除奇怪的边框?

时间:2016-01-14 08:03:17

标签: css css3

我的剪辑路径(六边形)元素为伪(:before:after)。

.cssload-cssload-spinner {
  position: relative;
  border: none;
}

.cssload-cssload-spinner:before,
.cssload-cssload-spinner:after {
  display: block;
  content: ' ';
  width: 88px;
  height: 88px;
  border: none;
  outline: none;
  clip-path: polygon(50% 0, 7% 26%, 7% 74%, 50% 100%, 93% 74%, 93% 26%, 83% 32%, 83% 69%, 50% 89%, 17% 69%, 17% 32%, 50% 12%, 83% 32%, 93% 26%);
}

使用css动画制作动画的伪元素。我在添加动画后看到了starange边框。

borders!!

无法使用border: noneoutline: none删除它(我不再有任何想法)。

我如何删除边框?

示例:



.cssload-wrap {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  display: -o-flex;
  display: -ms-flex;
  display: -webkit-flex;
  display: -moz-flex;
  box-pack: center;
  -o-box-pack: center;
  -ms-box-pack: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -o-justify-content: center;
  -ms-justify-content: center;
  -webkit-justify-content: center;
  -moz-justify-content: center;
  box-align: center;
  -o-box-align: center;
  -ms-box-align: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -o-align-items: center;
  -ms-align-items: center;
  -webkit-align-items: center;
  -moz-align-items: center;
  perspective: 390px;
  -o-perspective: 390px;
  -ms-perspective: 390px;
  -webkit-perspective: 390px;
  -moz-perspective: 390px;
  height: 100vh;
  overflow: hidden;
}

.cssload-cssload-spinner {
  position: relative;
  border: none;
  transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  animation: cssload-wobble 4.59s ease-in-out infinite;
  -o-animation: cssload-wobble 4.59s ease-in-out infinite;
  -ms-animation: cssload-wobble 4.59s ease-in-out infinite;
  -webkit-animation: cssload-wobble 4.59s ease-in-out infinite;
  -moz-animation: cssload-wobble 4.59s ease-in-out infinite;
}

.cssload-cssload-spinner:before,
.cssload-cssload-spinner:after {
  display: block;
  content: ' ';
  border: none;
  width: 88px;
  height: 88px;
  outline: none;
  -webkit-clip-path: polygon(50% 0, 7% 26%, 7% 74%, 50% 100%, 93% 74%, 93% 26%, 83% 32%, 83% 69%, 50% 89%, 17% 69%, 17% 32%, 50% 12%, 83% 32%, 93% 26%);
  clip-path: polygon(50% 0, 7% 26%, 7% 74%, 50% 100%, 93% 74%, 93% 26%, 83% 32%, 83% 69%, 50% 89%, 17% 69%, 17% 32%, 50% 12%, 83% 32%, 93% 26%);
  animation: cssload-spin 1.73s ease-in-out infinite both reverse;
  -o-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
  -ms-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
  -webkit-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
  -moz-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
}

.cssload-cssload-spinner:before {
  background-color: #02baff;
  position: absolute;
}

.cssload-cssload-spinner:after {
  background-color: #4c4c4c;
  animation-delay: -0.86s;
  -o-animation-delay: -0.86s;
  -ms-animation-delay: -0.86s;
  -webkit-animation-delay: -0.86s;
  -moz-animation-delay: -0.86s;
}

@keyframes cssload-wobble {
  0%,
  100% {
    -webkit-transform: rotateX(8.75deg) rotateY(35deg);
    transform: rotateX(8.75deg) rotateY(35deg);
  }
  50% {
    -webkit-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
  }
}

@-webkit-keyframes cssload-wobble {
  0%,
  100% {
    -webkit-transform: rotateX(8.75deg) rotateY(35deg);
  }
  50% {
    -webkit-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
  }
}

@keyframes cssload-spin {
  0%,
  100% {
    -webkit-transform: translateZ(49px) rotateX(14deg);
    transform: translateZ(49px) rotateX(14deg);
  }
  33% {
    -webkit-transform: translateZ(-49px) scale(0.4);
    transform: translateZ(-49px) scale(0.4);
  }
  66% {
    -webkit-transform: translateZ(-49px);
    transform: translateZ(-49px);
  }
}

@-webkit-keyframes cssload-spin {
  0%,
  100% {
    -webkit-transform: translateZ(49px) rotateX(14deg);
  }
  33% {
    -webkit-transform: translateZ(-49px) scale(0.4);
  }
  66% {
    -webkit-transform: translateZ(-49px);
  }
}

<div class="cssload-wrap">
  <div class="cssload-cssload-spinner"></div>
</div>
&#13;
&#13;
&#13;

仅适用于Chrome http://codepen.io/sattellite/pen/RrZpBB

更新:示例已经避开了这个奇怪的边界。由Joseph Marikle

解决

1 个答案:

答案 0 :(得分:1)

enter image description here

   .cssload-wrap {
    display: flex;
    display: -o-flex;
    display: -ms-flex;
    display: -webkit-flex;
    display: -moz-flex;
    box-pack: center;
    -o-box-pack: center;
    -ms-box-pack: center;
    -webkit-box-pack: center;
    -moz-box-pack: center;
    justify-content: center;
    -o-justify-content: center;
    -ms-justify-content: center;
    -webkit-justify-content: center;
    -moz-justify-content: center;
    box-align: center;
    -o-box-align: center;
    -ms-box-align: center;
    -webkit-box-align: center;
    -moz-box-align: center;
    align-items: center;
    -o-align-items: center;
    -ms-align-items: center;
    -webkit-align-items: center;
    -moz-align-items: center;
    perspective: 390px;
    -o-perspective: 390px;
    -ms-perspective: 390px;
    -webkit-perspective: 390px;
    -moz-perspective: 390px;
    height: 100vh;
    overflow: hidden;
  }
  .cssload-cssload-spinner {
    position: relative;
    transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    animation: cssload-wobble 4.59s ease-in-out infinite;
    -o-animation: cssload-wobble 4.59s ease-in-out infinite;
    -ms-animation: cssload-wobble 4.59s ease-in-out infinite;
    -webkit-animation: cssload-wobble 4.59s ease-in-out infinite;
    -moz-animation: cssload-wobble 4.59s ease-in-out infinite;
  }
  .cssload-cssload-spinner:before,
  .cssload-cssload-spinner:after {
    display: block;
    content: ' ';
    border-radius: 50%;
    width: 88px;
    height: 88px;
    -webkit-clip-path: polygon(50% 0, 7% 26%, 7% 74%, 50% 100%, 93% 74%, 93% 26%, 83% 32%, 83% 69%, 50% 89%, 17% 69%, 17% 32%, 50% 12%, 83% 32%, 93% 26%);
    clip-path: polygon(50% 0, 7% 26%, 7% 74%, 50% 100%, 93% 74%, 93% 26%, 83% 32%, 83% 69%, 50% 89%, 17% 69%, 17% 32%, 50% 12%, 83% 32%, 93% 26%);
    animation: cssload-spin 1.73s ease-in-out infinite both reverse;
    -o-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
    -ms-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
    -webkit-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
    -moz-animation: cssload-spin 1.73s ease-in-out infinite both reverse;
  }
  .cssload-cssload-spinner:before {
    background-color: #02baff;
    position: absolute;
  }
  .cssload-cssload-spinner:after {
    background-color: #4c4c4c;
    animation-delay: -0.86s;
    -o-animation-delay: -0.86s;
    -ms-animation-delay: -0.86s;
    -webkit-animation-delay: -0.86s;
    -moz-animation-delay: -0.86s;
  }
  @keyframes cssload-wobble {
    0%,
    100% {
      transform: rotateX(8.75deg) rotateY(35deg);
    }
    50% {
      transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    }
  }
  @-o-keyframes cssload-wobble {
    0%,
    100% {
      -o-transform: rotateX(8.75deg) rotateY(35deg);
    }
    50% {
      -o-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    }
  }
  @-ms-keyframes cssload-wobble {
    0%,
    100% {
      -ms-transform: rotateX(8.75deg) rotateY(35deg);
    }
    50% {
      -ms-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    }
  }
  @-webkit-keyframes cssload-wobble {
    0%,
    100% {
      -webkit-transform: rotateX(8.75deg) rotateY(35deg);
    }
    50% {
      -webkit-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    }
  }
  @-moz-keyframes cssload-wobble {
    0%,
    100% {
      -moz-transform: rotateX(8.75deg) rotateY(35deg);
    }
    50% {
      -moz-transform: rotateX(35deg) rotateY(-35deg) rotate(180deg);
    }
  }
  @keyframes cssload-spin {
    0%,
    100% {
      transform: translateZ(49px) rotateX(14deg);
    }
    33% {
      transform: translateZ(-49px) scale(0.4);
    }
    66% {
      transform: translateZ(-49px);
    }
  }
  @-o-keyframes cssload-spin {
    0%,
    100% {
      -o-transform: translateZ(49px) rotateX(14deg);
    }
    33% {
      -o-transform: translateZ(-49px) scale(0.4);
    }
    66% {
      -o-transform: translateZ(-49px);
    }
  }
  @-ms-keyframes cssload-spin {
    0%,
    100% {
      -ms-transform: translateZ(49px) rotateX(14deg);
    }
    33% {
      -ms-transform: translateZ(-49px) scale(0.4);
    }
    66% {
      -ms-transform: translateZ(-49px);
    }
  }
  @-webkit-keyframes cssload-spin {
    0%,
    100% {
      -webkit-transform: translateZ(49px) rotateX(14deg);
    }
    33% {
      -webkit-transform: translateZ(-49px) scale(0.4);
    }
    66% {
      -webkit-transform: translateZ(-49px);
    }
  }
  @-moz-keyframes cssload-spin {
    0%,
    100% {
      -moz-transform: translateZ(49px) rotateX(14deg);
    }
    33% {
      -moz-transform: translateZ(-49px) scale(0.4);
    }
    66% {
      -moz-transform: translateZ(-49px);
    }
  }

see the outline free image here