Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Make a Picture rotate Continuously? [closed]

) I have a star image in top-left of my screen want to rotate continuously. so can anyone tell me How can we make a Picture rotate Continuously for browsers Mozilla Firefox, Google chrome!? [Css Position type is 'Absolutely' and image resolution:25*25 ]

like image 797
Alireza29675 Avatar asked Apr 12 '12 12:04

Alireza29675


People also ask

How do I permanently rotate a JPEG?

Open the Photos app by clicking Start > Photos. Open the image you want to rotate. Click on the Rotate icon near the top center. You can also press CTRL + R to rotate the image.


2 Answers

@-webkit-keyframes rotate {
  from {
    -webkit-transform: rotate(0deg);
  }
  to { 
    -webkit-transform: rotate(360deg);
  }
}

img.star {
    -webkit-animation-name:            rotate; 
    -webkit-animation-duration:        0.5s; 
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
}

Add -moz-transform/animation, -ms-transform/animation, etc rules to support other browsers.

You could also make an animated GIF :).

Update

Animation support is available is most current browsers which means that the prefixes can be removed:

(For reverse rotation flip the 'from' and 'to')

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

img.star {
    animation-name:            rotate; 
    animation-duration:        0.5s; 
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

Shorthand:

img.star {
    animation: rotate 0.5s infinite linear;
}
like image 117
Frank van Wijk Avatar answered Sep 23 '22 15:09

Frank van Wijk


You can do that with CSS: (utilizing your GPU core):

img{ 
    animation:2s rotate infinite linear; 
}

@keyframes rotate{
    100%{ transform:rotate(1turn) } // or 360deg
}
<img src="https://ih0.redbubble.net/image.364229144.1663/flat,200x200,075,t.jpg">
like image 40
vsync Avatar answered Sep 22 '22 15:09

vsync