【问题标题】:how to make moving spinner's edges rounded css如何使移动微调器的边缘圆形CSS
【发布时间】:2016-07-27 14:17:00
【问题描述】:

Here 是我的小提琴链接。我用 css 创建了一个移动的微调器。但是旋转/移动的黑色部分应该有圆形边缘。无法从我现在拥有的东西中得到它。

.loader {
    position: relative;
    border-top: 10px solid #805da4;
    border-right: 10px solid #805da4;
    border-bottom: 10px solid #805da4;
    border-left: 10px solid #000;
    -webkit-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-animation-name: spinner;
    -webkit-animation-duration: 3s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
    -webkit-animation-delay: 0s;
    display: block;
    border-radius: 50%;
    width: 100%;
    height: 100%;
}

【问题讨论】:

  • 你需要 SVG...
  • 请问有没有办法在没有 SVG 的情况下做到这一点? @Paulie_D
  • 你不能改变“黑色部分”的边框,因为它本身已经是一个边框(开始变换之前的左边框)
  • 不,不是真的...<canvas> 也许但不是这样的边框。
  • @Paulie_D,现在请检查我的答案。我在没有 SVG 的情况下实现了它

标签: jquery html css css-transitions loader


【解决方案1】:

在 HTML 代码中

<div class="highlightRoundBox">
<span class="loading">
<span class="edge edge-left"></span>
<span class="edge edge-right"></span>
</span>
</div>

在 CSS 代码中

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
.highlightRoundBox {
    position: relative;
    margin: 11px 27px 13px 6px;
    width:68px;
    height: 68px;
}
.loading {
  display:block;
  position:relative;
    border-radius: 50%;
    width: 100%;
    height: 100%;
    border: 0.5rem solid #805da4;
    border-top-color: #000;
    animation: spin 1s infinite linear;
}
.loading .edge {
  display:block;
  position: absolute;
  border-radius: 50%;
  width: 0.5rem;
  height: 0.5rem;
  background:#000;
}
.loading .edge.edge-left
{
   top:0.22rem;
  left:0.2rem;
}
.loading .edge.edge-right
{
  top:0.20em;
  right:0.22em;
}

查看链接https://jsfiddle.net/4yL3rp38/22/

【讨论】:

  • 黑色边框的圆边在哪里。我看不到圆边@Haresh Vidja
  • 但它不起作用。你能检查一下你的小提琴吗?没看到有什么动静? @Haresh Vidja
  • 圆角在哪里?我还是没看到。 @Haresh Vidja
  • 您好女士,在您的小提琴链接中,除了圆角,我没有看到任何圆角。你能分享你的屏幕截图吗?
  • 这正是我的问题,如果您阅读我的问题,您就会明白。我需要那个黑色的移动微调器是圆形的。请仔细阅读我的问题@Haresh Vidja
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-01-28
  • 1970-01-01
  • 2019-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-09-28
相关资源
最近更新 更多