Skip to content

Commit fa81a49

Browse files
committed
merging: set up cleaned, paddind added
1 parent 0a6c4df commit fa81a49

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

js/secrets.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
// Setup the canvas
2-
var type = /(canvas|webgl)/.test(url.type) ? url.type : 'svg';
3-
var two = new Two({
4-
type: Two.Types[type],
5-
fullscreen: true,
6-
autostart: true
7-
}).appendTo(document.body);
8-
// document.body.style.background = 'black';
1+
var shapes;
2+
window.onresize = function() {
3+
setup();
4+
}
95

6+
$(function() {
7+
setup();
8+
});
109

11-
var radius = 0, rows = 0, cols = 0, size;
12-
var isMobile = window.matchMedia("only screen and (max-width: 850px)").matches ||
13-
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
14-
var isOtherMediaQuery = window.matchMedia("only screen and (min-width:1080px)").matches;
15-
if(isMobile && !isOtherMediaQuery) {
16-
size = 200;
17-
} else {
18-
size = 150;
19-
}
20-
rows = Math.floor(two.height / size);
21-
cols = Math.floor(two.width / size);
22-
radius = Math.floor(Math.max(two.width, two.height) / Math.max(rows, cols)) / 2;
23-
var flowers = [];
24-
var shapes = makeFlowers();
10+
function setup() {
11+
var height = $('body').height();
12+
var width = $('body').width();
13+
var size = 150;
14+
var padding = 50;
2515

16+
var isMobile = window.matchMedia("only screen and (max-width: 450px)").matches ||
17+
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
18+
var isOtherMediaQuery = window.matchMedia("only screen and (min-width:1080px)").matches;
19+
if(isMobile && !isOtherMediaQuery) {
20+
size = 250;
21+
padding = 250;
22+
}
23+
var rows = Math.floor(height / size);
24+
var cols = Math.floor(width / size);
25+
var radius = Math.floor(Math.max(width, height) / Math.max(rows - 1, cols - 1)) / 2;
2626

2727
for (var r = 0; r < rows; r++) {
2828
// even rows have an offset of 0.5

0 commit comments

Comments
 (0)