CSS3 Continuous Rotate Animation (Just like a loading sundial)

后端 未结 6 1692
灰色年华
灰色年华 2020-11-30 19:36

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

6条回答
  •  一向
    一向 (楼主)
    2020-11-30 20:28

    I made a small library that lets you easily use a throbber without images.

    It uses CSS3 but falls back onto JavaScript if the browser doesn't support it.

    // First argument is a reference to a container element in which you
    // wish to add a throbber to.
    // Second argument is the duration in which you want the throbber to
    // complete one full circle.
    var throbber = throbbage(document.getElementById("container"), 1000);
    
    // Start the throbber.
    throbber.play();
    
    // Pause the throbber.
    throbber.pause();
    

    Example.

提交回复
热议问题