From e5b46da0d5337230478ccf390839fa7fda96d10e Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 24 May 2012 13:43:46 +0000 Subject: [PATCH] update loading icon --- source/Ox.UI/js/Core/Ox.LoadingIcon.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.LoadingIcon.js b/source/Ox.UI/js/Core/Ox.LoadingIcon.js index 3cfaa732..5e27f49e 100644 --- a/source/Ox.UI/js/Core/Ox.LoadingIcon.js +++ b/source/Ox.UI/js/Core/Ox.LoadingIcon.js @@ -30,16 +30,20 @@ Ox.LoadingIcon = function(options, self) { () -> Loading Icon Element @*/ that.start = function() { - var deg = 0; + var css, deg = 0, previousTime = +new Date(); if (!self.loadingInterval) { 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({ - OTransform: 'rotate(' + deg + 'deg)', - MozTransform: 'rotate(' + deg + 'deg)', - WebkitTransform: 'rotate(' + deg + 'deg)' + OTransform: css, + MozTransform: css, + WebkitTransform: css }); - }, 83) + }, 83); that.animate({opacity: 1}, 250); } return that;