views:

614

answers:

3

Hi,

I am trying to replicate an Apple style activity indicator (sundial loading icon) by using a PNG and CSS3 animation. I have the image rotating and doing it continuously, but there seems to be a delay after the animation has finished before it does the next rotation.

@-webkit-keyframes rotate {
  from {
    -webkit-transform: rotate(0deg);
  }
  to { 
    -webkit-transform: rotate(360deg);
  }
}
#loading img
{
    -webkit-animation-name:             rotate; 
    -webkit-animation-duration:         0.5s; 
    -webkit-animation-iteration-count:  infinite;
    -webkit-transition-timing-function: linear;
    }

I have tried changing the animation duration but it makes no difference, if you slow it right down say 5s its just more apparent that after the first rotation there is a pause before it rotates again. It's this pause I want to get rid of.

Any help is much appreciated, thanks.

A: 

Your code seems correct. I would presume it is something to do with the fact you are using a .png and the way the browser redraws the object upon rotation is inefficient, causing the hang (what browser are you testing under?)

If possible replace the .png with something native.

see; http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/

Chrome gives me no pauses using this method.

Alex
Perfect, I am pretty sure your assumption is correct however I am using a PNG because my loading icon isn't a sundial its a nuclear style symbol... It doesn't have to be though so I can change it to the method you suggest - thanks!
Gcoop
+1  A: 

EDIT TO MY EARLIER POST:

Your issue here is that you've supplied a "-webkit-TRANSITION-timing-function" when you want a "-webkit-ANIMATION-timing-function". Your values of 0 to 360 will work properly.

rrahlf
Awesome thank you
Gcoop