update loading icon

This commit is contained in:
rlx 2012-05-24 13:43:46 +00:00
parent 4b454790d5
commit e5b46da0d5

View file

@ -30,16 +30,20 @@ Ox.LoadingIcon = function(options, self) {
() -> <f> Loading Icon Element () -> <f> Loading Icon Element
@*/ @*/
that.start = function() { that.start = function() {
var deg = 0; var css, deg = 0, previousTime = +new Date();
if (!self.loadingInterval) { if (!self.loadingInterval) {
self.loadingInterval = setInterval(function() { self.loadingInterval = setInterval(function() {
deg = (deg + 30) % 360; var currentTime = +new Date(),
delta = (currentTime - previousTime) / 1000;
previousTime = currentTime;
deg = Math.round((deg + delta * 360) % 360 / 30) * 30;
css = 'rotate(' + deg + 'deg)';
that.css({ that.css({
OTransform: 'rotate(' + deg + 'deg)', OTransform: css,
MozTransform: 'rotate(' + deg + 'deg)', MozTransform: css,
WebkitTransform: 'rotate(' + deg + 'deg)' WebkitTransform: css
}); });
}, 83) }, 83);
that.animate({opacity: 1}, 250); that.animate({opacity: 1}, 250);
} }
return that; return that;