fixed high cpu consumption on mobile devices

This commit is contained in:
Timm Szigat 2015-01-25 20:03:38 +01:00
parent 2355d858d4
commit a219eab24f
2 changed files with 187 additions and 181 deletions

BIN
images/gekruessel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 KiB

View File

@ -1,5 +1,11 @@
(function() { (function() {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
var element = document.getElementById('demo-canvas');
element.style.backgroundImage="url('images/gekruessel.png')";
element.style.backgroundPosition="center center";
element.style.height="300px";
} else {
var width, height, largeHeader, canvas, ctx, points, target, animateHeader = true; var width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
// Main // Main
@ -181,5 +187,5 @@
function getDistance(p1, p2) { function getDistance(p1, p2) {
return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2); return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
} }
}
})(); })();