Flipping an icon and spinning it in reverse

帅比萌擦擦* 提交于 2019-12-06 11:06:34
Okku

Your animation is overriding the initial transform. You need to apply both of the transforms in your animation:

.fa-refresh {
  transform: scaleX(-1);
  animation: spin-reverse 2s infinite linear;
}
@keyframes spin-reverse {
  0% {
    transform: scaleX(-1) rotate(-360deg);
  }
  100% {
    transform: scaleX(-1) rotate(0deg);
  }
}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<i class="fa fa-refresh"></i>

You can also solve the problem without additional CSS.

The outer <i> flips the inner <i> first. The inner <i> spins. See here:

<i class="fa fa-flip-vertical">
  <i class="fa fa-spin fa-refresh"></i>
</i>
Atif Saleem

The simple way to reverse your animation is to reverse the direction of its CSS property called animation-direction.

animation-direction: reverse;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!