【问题标题】:How do I rotate an SVG path element without it moving in circles?如何在不绕圈移动的情况下旋转 SVG 路径元素?
【发布时间】:2021-05-14 01:45:02
【问题描述】:

我有一个带有 3 条路径的 SVG,但只需要 em 持续旋转。这在具有一条路径但不适用于这条路径的 SVG 上效果很好,而且我还有其他一些我可以在固定位置上旋转的路径。 Here is the source code with preview!

  .rotate {
  animation: rotation 8s infinite linear;
}

@keyframes rotation {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(359deg);
  }
}

【问题讨论】:

    标签: css svg svg-animate


    【解决方案1】:

    可以变换旋转原点,默认原点是左上角。 要围绕其中心旋转项目,您必须转换原点。

    .rotate {
        transform-origin: 50% 50%;
        animation: rotation 8s infinite linear;
    }
    

    【讨论】:

    猜你喜欢
    • 2018-07-01
    • 2018-12-03
    • 1970-01-01
    • 2015-10-03
    • 2021-07-16
    • 2019-09-14
    • 2018-03-30
    相关资源
    最近更新 更多