File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -24,21 +24,29 @@ function setup() {
2424 var cols = Math . floor ( width / size ) ;
2525 var radius = Math . floor ( Math . max ( width , height ) / Math . max ( rows - 1 , cols - 1 ) ) / 2 ;
2626
27+ if ( isMobile && ! isOtherMediaQuery ) {
28+ radius = Math . floor ( height / ( rows + 2 ) ) ;
29+ }
30+
31+ makeGrid ( rows , cols ) ;
32+ shapes = makeFlowers ( radius ) ;
33+ addSvgsToCells ( size , padding ) ;
34+ offsetEvenRows ( size + padding ) ;
35+ }
36+
37+ function addSvgsToCells ( size , padding ) {
38+ $ ( ".cell" ) . each ( function ( index , object ) {
39+ var two = new Two ( {
40+ width : size + padding ,
41+ height :size + padding
42+ } ) . appendTo ( object ) ;
2743 var shape = pickFlower ( shapes ) ;
28- shape . translation . set ( hi * two . width , vi * two . height ) ;
29- flowers . push ( shape ) ;
44+ shape . translation . set ( two . width / 2 , two . height / 2 ) ;
3045 two . add ( shape ) ;
31- }
46+ two . update ( ) ;
47+ } ) ;
3248}
33- two . update ( ) ;
3449
35- for ( var f in flowers ) {
36- var flower = flowers [ f ] ;
37- console . log ( flower . id ) ;
38- $ ( flower . _renderer . elem )
39- . click ( function ( e ) {
40- flower . fill = "blue" ;
41- } )
4250function offsetEvenRows ( size ) {
4351 $ ( ".row" ) . each ( function ( index , object ) {
4452 if ( index % 2 ) {
You can’t perform that action at this time.
0 commit comments