Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
56
rated 0 times [  62] [ 6]  / answers: 1 / hits: 52301  / 12 Years ago, thu, april 12, 2012, 12:00:00

) 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 ]


More From » jquery

 Answers
51
@-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;
}

[#86284] Wednesday, April 11, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
catrinas

Total Points: 587
Total Questions: 100
Total Answers: 105

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
;