@@ -10,35 +10,31 @@ $(function() {
1010function setup ( ) {
1111 var height = $ ( 'body' ) . height ( ) ;
1212 var width = $ ( 'body' ) . width ( ) ;
13+ var size = 150 ;
14+ var padding = 20 ;
15+
16+ var isMobile = window . matchMedia ( "only screen and (max-width: 850px)" ) . matches ||
17+ / A n d r o i d | w e b O S | i P h o n e | i P a d | i P o d | B l a c k B e r r y | I E M o b i l e | O p e r a M i n i / 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 = 40 ;
22+ }
1323
14- var size = getShapeSize ( ) ;
1524 var rows = Math . floor ( height / size ) ;
1625 var cols = Math . floor ( width / size ) ;
1726 var radius = Math . floor ( Math . max ( width , height ) / Math . max ( rows , cols ) ) / 2 ;
1827
1928 makeGrid ( rows , cols ) ;
2029 shapes = makeFlowers ( radius ) ;
21- addSvgsToCells ( size ) ;
22- }
23-
24- function getShapeSize ( ) {
25- var size ;
26- var isMobile = window . matchMedia ( "only screen and (max-width: 850px)" ) . matches ||
27- / A n d r o i d | w e b O S | i P h o n e | i P a d | i P o d | B l a c k B e r r y | I E M o b i l e | O p e r a M i n i / i. test ( navigator . userAgent ) ;
28- var isOtherMediaQuery = window . matchMedia ( "only screen and (min-width:1080px)" ) . matches ;
29- if ( isMobile && ! isOtherMediaQuery ) {
30- size = 200 ;
31- } else {
32- size = 150 ;
33- }
34- return size ;
30+ addSvgsToCells ( size , padding ) ;
3531}
3632
37- function addSvgsToCells ( size ) {
33+ function addSvgsToCells ( size , padding ) {
3834 $ ( ".cell" ) . each ( function ( index , object ) {
3935 var two = new Two ( {
40- width : size + 20 ,
41- height :size + 20
36+ width : size + padding ,
37+ height :size + padding
4238 } ) . appendTo ( object ) ;
4339 var shape = pickFlower ( shapes ) ;
4440 shape . translation . set ( two . width / 2 , two . height / 2 ) ;
0 commit comments