File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ const v = new Voronoi();
12
12
function draw ( ) {
13
13
14
14
// round the size of the pieces so the bezel is more uniform
15
- xRange = ( BOUNDS . xr - BOUNDS . xl - controls . bezel * 2 ) ;
15
+ xRange = ( BOUNDS . xr - BOUNDS . xl ) ;
16
16
xSlices = Math . ceil ( xRange / controls . pieceSize ) ;
17
17
xLength = xRange / xSlices ;
18
- yRange = ( BOUNDS . yb - BOUNDS . yt - controls . bezel * 2 ) ;
18
+ yRange = ( BOUNDS . yb - BOUNDS . yt ) ;
19
19
ySlices = Math . ceil ( yRange / controls . pieceSize ) ;
20
20
yLength = yRange / ySlices ;
21
21
@@ -30,9 +30,11 @@ function draw(){
30
30
pieces . push ( piece ) ;
31
31
}
32
32
33
- pieces [ p ] . originX = ( x + 0.5 ) * xLength + controls . bezel ;
34
- pieces [ p ] . originY = ( y + 0.5 ) * yLength + controls . bezel ;
33
+ pieces [ p ] . originX = ( x + 0.5 ) * xLength ;
34
+ pieces [ p ] . originY = ( y + 0.5 ) * yLength ;
35
35
pieces [ p ] . randomize ( ) ;
36
+ pieces [ p ] . x = pieces [ p ] . x - ( ( pieces [ p ] . x / xRange ) * 2 - 1 ) * controls . bezel ;
37
+ pieces [ p ] . y = pieces [ p ] . y - ( ( pieces [ p ] . y / yRange ) * 2 - 1 ) * controls . bezel ;
36
38
pieces [ p ] . el . setAttributeNS ( null , 'cx' , pieces [ p ] . x ) ;
37
39
pieces [ p ] . el . setAttributeNS ( null , 'cy' , pieces [ p ] . y ) ;
38
40
You can’t perform that action at this time.
0 commit comments