围绕点旋转文本项目而不旋转



我想围绕中心点旋转文本(附加到滚动位置)。我不希望的是项目被旋转和不可读。他们应该在圆形路径上移动。你有什么想法我怎么能做到这一点吗?

我正在使用 Skrollr 进行滚动动画,但我对任何事情都持开放态度。

起始位置

轮换进行中

只是想一下,您可以使用普通的 css 关键帧来实现这一点。您可以在某个事件上触发父元素上的类,并将动画设置为仅在应用此类时发生。我做了一个简单的片段来演示。不确定这是否适合您的情况。

@keyframes circle {
    from { transform:rotate(0deg); }
    to { transform:rotate(360deg); }
}
@keyframes inner-circle {
    from { transform:rotate(0deg); }
    to { transform:rotate(-360deg); }
}
.wrapper {
  position: relative;
  width: 400px;
  height: 400px;
  background-color: #CCCCCC;
  border-radius: 50%;
  font-size:12px;
  animation: circle 5s linear infinite;
}
img {
  width: 75px;
  height: 75px;
}
.div1 {
    position: absolute;
    width:100px;
    height:100px;
    margin: 20px auto 0;
    transform-origin:50% 50%;
}
.div2 {
    position: absolute;
    width:100px;
    height:100px;
    margin: 275px auto 0;
    color:red;
    transform-origin:50% 50%;
}
.div3 {
    width:100px;
    height:100px;
    margin: 20px auto 0;
    color:blue;
    transform-origin:50% 200px;
}
.div4 {
    width:100px;
    height:100px;
    margin: 20px auto 0;
    color:green;
    transform-origin:50% 200px;
}
div > div {
    animation: inner-circle 5s linear infinite;
}
<div class="wrapper">
  <div class="div1">
    <img src="https://cdn0.iconfinder.com/data/icons/star-wars/512/darth_vader-128.png" />
    <p>
      This is some text lorem
    </p>
  </div>
  <div class="div2">
    <img src="https://cdn0.iconfinder.com/data/icons/star-wars/512/darth_vader-128.png" />
    <p>
      This is some text lorem
    </p>
  </div>
</div>

最新更新