动画中的圆圈是如何扭曲的?

发布于 2025-01-09 13:28:58 字数 1637 浏览 0 评论 0原文

使用这段代码,点会反弹,但我不知道如何进行转换来改变点的形状。

我在 https://lottiefiles.com/87015-loading 找到了这个设计,但我找不到提取CSS。它给了我一个 json 但我需要 CSS。

这是动画:

加载点

.dot-typing {
  position: relative;
  left: -9999px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: #9880ff;
  color: #9880ff;
  box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  animation: dotTyping 1s infinite linear;
}

@keyframes dotTyping {
  0% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  16.667% {
    box-shadow: 9984px -10px 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  33.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  50% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px -10px 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  66.667% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  83.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px -10px 0 0 #9880ff;
  }
  100% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
}
<div class="snippet" data-title=".dot-elastic dot-typing">
  <div class="stage">
    <div class="dot-elastic dot-typing"></div>
  </div>
</div>

With this code the points bounce, but I don't know how to do the transformation to change the shape of the points.

I found this design at https://lottiefiles.com/87015-loading, but I couldn't extract the CSS. It gives me a json but I need the CSS.

Here is the animation:

Loading dots

.dot-typing {
  position: relative;
  left: -9999px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: #9880ff;
  color: #9880ff;
  box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  animation: dotTyping 1s infinite linear;
}

@keyframes dotTyping {
  0% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  16.667% {
    box-shadow: 9984px -10px 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  33.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  50% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px -10px 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  66.667% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
  83.333% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px -10px 0 0 #9880ff;
  }
  100% {
    box-shadow: 9984px 0 0 0 #9880ff, 9999px 0 0 0 #9880ff, 10014px 0 0 0 #9880ff;
  }
}
<div class="snippet" data-title=".dot-elastic dot-typing">
  <div class="stage">
    <div class="dot-elastic dot-typing"></div>
  </div>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初与友歌 2025-01-16 13:28:58

与您要求的动画相近的动画是我在

https://jsfiddle.net/e3uwb64a/202< /a>

HTML

<div class="container">
  <div class="ball">
    <span class="top" ></span>
    <span class="bottom" ></span>
  </div>
  <div class="ball">
    <span class="top"></span>
    <span class="bottom" ></span>
  </div>
  <div class="ball">
    <span class="top"></span>
    <span class="bottom" ></span>
  </div>
</div>

CSS

 @keyframes bounce{
  0%{
    transform: translateY(0px);
  }
  33.33%{
    transform: translateY(-30px);
  }
  66.66%{
    transform: translateY(30px);
  }

}

@keyframes eggItTop{
  0%{
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
  }
  33.33%{
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 00px;
  }
  66.66%{
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-left-radius: 00px;
    border-bottom-right-radius: 0px;
  }
}

@keyframes eggItBottom{
  0%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
  }
  33.33%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
  }
  66.66%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
  }
}



.container{
  display: flex;
  > div:nth-child(1){
    animation-delay: 0.2s;
    > span{
      animation-delay: 0.2s;
    }
  }
  > div:nth-child(2){
    animation-delay: 0.4s;
    > span{
      animation-delay: 0.4s;
    }
  }
  > div:nth-child(3){
    animation-delay: 0.6s;
    > span{
      animation-delay: 0.6s;
    }
  }
}

.ball{
  display: flex;
  flex-direction: column;
  margin: 30px;
  margin-top: 100px;
  animation: bounce 1s ease-out infinite;
  > span{
      width: 50px;
      height: 25px;
      background-color: #f05c1d;
      margin: 0px;
  }
}

.top{
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  border-bottom-left-radius: 0%;
  border-bottom-right-radius: 0%;
  animation: eggItTop 1s ease-out infinite;
  
}

.bottom{
  border-top-left-radius: 0%;
  border-top-right-radius: 0%;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  animation: eggItBottom 1s ease-out infinite;
  transform: translateY(-1px) /* just to hide a distubing line that show up on animation */
  
}

你可以尝试使用它来获得你想要的。

One close animation to the one you are asking for I made it on

https://jsfiddle.net/e3uwb64a/202

HTML

<div class="container">
  <div class="ball">
    <span class="top" ></span>
    <span class="bottom" ></span>
  </div>
  <div class="ball">
    <span class="top"></span>
    <span class="bottom" ></span>
  </div>
  <div class="ball">
    <span class="top"></span>
    <span class="bottom" ></span>
  </div>
</div>

CSS

 @keyframes bounce{
  0%{
    transform: translateY(0px);
  }
  33.33%{
    transform: translateY(-30px);
  }
  66.66%{
    transform: translateY(30px);
  }

}

@keyframes eggItTop{
  0%{
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 0px;
  }
  33.33%{
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom-left-radius: 0px;
    border-bottom-right-radius: 00px;
  }
  66.66%{
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-left-radius: 00px;
    border-bottom-right-radius: 0px;
  }
}

@keyframes eggItBottom{
  0%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
  }
  33.33%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
  }
  66.66%{
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
  }
}



.container{
  display: flex;
  > div:nth-child(1){
    animation-delay: 0.2s;
    > span{
      animation-delay: 0.2s;
    }
  }
  > div:nth-child(2){
    animation-delay: 0.4s;
    > span{
      animation-delay: 0.4s;
    }
  }
  > div:nth-child(3){
    animation-delay: 0.6s;
    > span{
      animation-delay: 0.6s;
    }
  }
}

.ball{
  display: flex;
  flex-direction: column;
  margin: 30px;
  margin-top: 100px;
  animation: bounce 1s ease-out infinite;
  > span{
      width: 50px;
      height: 25px;
      background-color: #f05c1d;
      margin: 0px;
  }
}

.top{
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  border-bottom-left-radius: 0%;
  border-bottom-right-radius: 0%;
  animation: eggItTop 1s ease-out infinite;
  
}

.bottom{
  border-top-left-radius: 0%;
  border-top-right-radius: 0%;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  animation: eggItBottom 1s ease-out infinite;
  transform: translateY(-1px) /* just to hide a distubing line that show up on animation */
  
}

you can try to play with it to get the one you want .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文