making the background less cpu intensive

master
Tezza 2015-02-27 00:45:42 +01:00
parent 9764b4441b
commit 9cc88603fc
2 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,11 @@
}
html,
body {
background: no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: 'Patrick Hand SC', sans-serif;
font-size: 18px;
overflow-x: hidden;

View File

@ -10,7 +10,6 @@ var t = new Trianglify(
x_gradient: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"]
}
);
var prevheight = height();
window.onresize = function() {
redraw();
@ -19,7 +18,7 @@ window.onresize = function() {
redraw();
function redraw() {
var pattern = t.generate(document.body.clientWidth, height());
var pattern = t.generate(window.innerWidth, window.innerHeight);
document.body.setAttribute('style', 'background-image: '+pattern.dataUrl);
}