speed up css transform

This commit is contained in:
rolux 2011-04-25 15:38:47 +02:00
parent 5f7f2b38b9
commit 7bede77748

View file

@ -26,10 +26,13 @@ Ox.load.UI = function(options, callback) {
version: 5
}
],
browserSupported = false;
browserSupported = false,
loadingInterval;
browsers.forEach(function(browser) {
var match = browser.regexp(navigator.userAgent);
// fixme: check if this remains broken in wekbit nightlies
// var match = browser.regexp(navigator.userAgent);
var match = browser.regexp.exec(navigator.userAgent);
if (match && match[1] >= browser.version) {
browserSupported = true;
}
@ -92,7 +95,8 @@ Ox.load.UI = function(options, callback) {
.appendTo(div);
});
*/
var deg = 0, element, interval,
var deg = 0,
element,
src = Ox.PATH + 'svg/Ox.UI.' + options.theme + '/symbolLoading.svg'
Ox.loadFile(src, function() {
element = Ox.element('<img>')
@ -107,13 +111,12 @@ Ox.load.UI = function(options, callback) {
e.preventDefault()
})
.appendTo(div);
setTimeout(function rotate() {
loadingInterval = setInterval(function() {
deg = (deg + 30) % 360;
element.css({
MozTransform: 'rotate(' + deg + 'deg)',
WebkitTransform: 'rotate(' + deg + 'deg)'
});
Ox.element('OxLoadingScreen')[0] && setTimeout(rotate, 83);
}, 83);
});
}
@ -267,6 +270,7 @@ Ox.load.UI = function(options, callback) {
$div.remove();
});
} else {
clearInterval(loadingInterval);
$div.remove();
}
});