Font-awesome: Spin in Reverse Direction

Created on 17 Jan 2013  路  32Comments  路  Source: FortAwesome/Font-Awesome

It'd be great if there was a class you could attach to an icon-* to have it spin in the reverse direction. It's easily doable by just adding the 'reverse' keyword to the animation, but it'd be great to have a class like icon-spin-reverse.

.icon-spin-reverse {
  -moz-animation: spin 2s infinite linear reverse;
  -o-animation: spin 2s infinite linear reverse;
  -webkit-animation: spin 2s infinite linear reverse;
  animation: spin 2s infinite linear reverse;
}

Or a chainable class:

.icon-spin.icon-spin-reverse {
  -moz-animation-direction: reverse;
  -o-animation-direction: reverse;
  -webkit-animation-direction: reverse;
  animation-direction: reverse;
}

reverse was added to the CSS3 spec relatively recently, and only Firefox 16+ and Chrome 19+ support it. Alternatively, it could be done by just inverting the spin keyframes for a spin-reverse class.

css enhancement

Most helpful comment

Here is another code. Based on fa-spin class. Just add to your css file.

.fa-spin-reverse {
  -webkit-animation: fa-spin-reverse 2s infinite linear;
  animation: fa-spin-reverse 2s infinite linear;
}
@-webkit-keyframes fa-spin-reverse {
  100% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  0% {
    -webkit-transform: rotate(359deg);
    transform: rotate(359deg);
  }
}
@keyframes fa-spin-reverse {
  100% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  0% {
    -webkit-transform: rotate(359deg);
    transform: rotate(359deg);
  }
}

to use:

<i class="fa fa-spin-reverse fa-cog"></i>

All 32 comments

+1

+1, this seems totally obvious, but maybe because I've dropped support for IE9 now than 10+11 are out.

+1

+1

+1

+1 :+1:

+1

+1

+1

+1

+1

+1

+1

do you know browser support of reverse?

I'm concerned it is not enough and we have to duplicate the whole animation

+1

+1

:+1:

+1

Here is another code. Based on fa-spin class. Just add to your css file.

.fa-spin-reverse {
  -webkit-animation: fa-spin-reverse 2s infinite linear;
  animation: fa-spin-reverse 2s infinite linear;
}
@-webkit-keyframes fa-spin-reverse {
  100% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  0% {
    -webkit-transform: rotate(359deg);
    transform: rotate(359deg);
  }
}
@keyframes fa-spin-reverse {
  100% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  0% {
    -webkit-transform: rotate(359deg);
    transform: rotate(359deg);
  }
}

to use:

<i class="fa fa-spin-reverse fa-cog"></i>

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daneren2005 picture daneren2005  路  3Comments

petermolnar picture petermolnar  路  3Comments

tdolph picture tdolph  路  3Comments

ojvribeiro picture ojvribeiro  路  3Comments

jakuuub picture jakuuub  路  3Comments