My gut feeling is that if you rendered the different stages of the animation into multiple images using canvas and just toggled their visibility, you could get better performance.
Interesting replies. 0% on IE 9 and Chrome 13, and 15% on firefox 5 (which translates to 60% of a core). Running Win 7 x64.
Aaaaaand... just upgraded to Firefox 6. 0%. Rather fickle piece of javascript, eh?
A spinner generated from http://www.ajaxload.info/ is 673 bytes. The minified javascript from this is ~3K. I suppose the trade off is features and flexibility, but I don't find myself needing much out of my ajax spinners.
Agreed... This is fine as an exercise but I don't want to maintain code for every minor component; I'd rather go with an image even if it were bigger than 3K.
I think the possibility of dynamically changing the speed of the spinner is interesting. If your spinner was representing a file upload, for example, you could conceivably adjust the speed based on the current upload rate.
Doesn't that defeat the purpose, though? Progress indicators are designed to make you think things are going faster than they are. If you want to display accurate information, why not just display it?
Are there any GIF loader generators that have all this options (speed, sizes, color) available? Could be good to use this as a preview, and then generate the final GIF.
This is cool just for fun, but practically there are sites like http://ajaxload.info/ that generate spinners for you, if you don't know how to do it yourself
I tried them and they produced poor quality. They couldn't even get the white background correct! I suppose their #1 ranking on Google is making them complacent.
http://www.loadinfo.net/ is much better presented and actually respects the color values you type in! (And no, I don't have any relationship with them.)
Tested it on my iPhone 3gs - after some scrolling around and zooming (trying to reach the controls) the spinner "locked up" - it's no longer spinning, every bar is simply pulsing together in time, like a luminescent jellyfish.
I wonder if this could happen in a regular browser, too?
It was noted in this thread that this consumes a relatively large amount of resources, and it was suggested that flipping through PNG frames would be less CPU-intensive.
I have a hunch that’s correct, but don’t know.
I do however have an unanswered question on Stack Overflow seeking, ideally, a generator of JavaScript + PNG throbbers. First one to make ajaxload.info with PNG sprites and/or Canvas generation in supported browsers wins! (No need for most of the hideous ajaxload designs though.) http://stackoverflow.com/questions/6937149/best-practice-too...
The only reason to use this is for scalable throbbers, and since you're only going to configure it once, it'd be much easier and more compact to just use a generated SVG+SMIL instead.
Read through quickly at first and got mislead by 'target' assuming that anything passed as a target will start spinning and tried to spin an image :), which of course is not the case. Nice effort though.
This would be perfect for canvas games. It means that image.gif doesn't have to load, which typically requires initializing a new Image() and attaching an onLoad function. This simplifies all that.
[+] [-] seanalltogether|14 years ago|reply
[+] [-] robert-boehnke|14 years ago|reply
[+] [-] tobbez|14 years ago|reply
Explorer is better than Firefox and Opera, but still pretty high CPU usage.
The only browser of the ones I tested that it seems to be relatively fine in is Chrome.
[+] [-] mrinterweb|14 years ago|reply
[+] [-] ralphsaunders|14 years ago|reply
[+] [-] darrenkopp|14 years ago|reply
[+] [-] zenijin|14 years ago|reply
[+] [-] bb999|14 years ago|reply
And just because why not:
IE 8 in a winXP vm: 0%
IE 6 in a winXP vm: 0%
Doesn't work in FF3.
[+] [-] conradev|14 years ago|reply
[+] [-] rubergly|14 years ago|reply
[+] [-] recoiledsnake|14 years ago|reply
[+] [-] Nycto|14 years ago|reply
[+] [-] tintin|14 years ago|reply
[+] [-] coverband|14 years ago|reply
[+] [-] jabkobob|14 years ago|reply
[+] [-] ww520|14 years ago|reply
[+] [-] jsdalton|14 years ago|reply
[+] [-] alanh|14 years ago|reply
- Progress bar. Indicates estimated percent completed at a glance. Perfect for uploads/downloads where file size and progress is known.
- Text and/or line/sparkline graph. If you only know speed, this is how to show it.
How is the user supposed to know spin rate means anything?
[+] [-] Cushman|14 years ago|reply
[+] [-] r00fus|14 years ago|reply
[+] [-] JohnnyBrown|14 years ago|reply
[+] [-] dw0rm|14 years ago|reply
[+] [-] gregory80|14 years ago|reply
[+] [-] rawsyntax|14 years ago|reply
[+] [-] heliodor|14 years ago|reply
http://www.loadinfo.net/ is much better presented and actually respects the color values you type in! (And no, I don't have any relationship with them.)
[+] [-] dalore|14 years ago|reply
[+] [-] hasenj|14 years ago|reply
[+] [-] pavel_lishin|14 years ago|reply
I wonder if this could happen in a regular browser, too?
[+] [-] alanh|14 years ago|reply
I have a hunch that’s correct, but don’t know.
I do however have an unanswered question on Stack Overflow seeking, ideally, a generator of JavaScript + PNG throbbers. First one to make ajaxload.info with PNG sprites and/or Canvas generation in supported browsers wins! (No need for most of the hideous ajaxload designs though.) http://stackoverflow.com/questions/6937149/best-practice-too...
[+] [-] Sephr|14 years ago|reply
[+] [-] justincormack|14 years ago|reply
[+] [-] onedognight|14 years ago|reply
[+] [-] Jarred|14 years ago|reply
It was spinning very slowly, but the Mango update supports CSS3 well it seems.
[+] [-] ck2|14 years ago|reply
[+] [-] uast23|14 years ago|reply
[+] [-] nicklovescode|14 years ago|reply
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] minikomi|14 years ago|reply
[+] [-] paisible|14 years ago|reply
[+] [-] jdelsman|14 years ago|reply
[+] [-] dougaitken|14 years ago|reply
[+] [-] wyclif|14 years ago|reply
Independent.