Skip to content

Commit 5cd0467

Browse files
author
Wray Bowling
committed
voronoise is processed before bezel
1 parent 2b48aed commit 5cd0467

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const v = new Voronoi();
1212
function draw(){
1313

1414
// 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);
1616
xSlices = Math.ceil(xRange / controls.pieceSize);
1717
xLength = xRange / xSlices;
18-
yRange = (BOUNDS.yb - BOUNDS.yt - controls.bezel*2);
18+
yRange = (BOUNDS.yb - BOUNDS.yt);
1919
ySlices = Math.ceil(yRange / controls.pieceSize);
2020
yLength = yRange / ySlices;
2121

@@ -30,9 +30,11 @@ function draw(){
3030
pieces.push(piece);
3131
}
3232

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;
3535
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;
3638
pieces[p].el.setAttributeNS(null,'cx',pieces[p].x);
3739
pieces[p].el.setAttributeNS(null,'cy',pieces[p].y);
3840

0 commit comments

Comments
 (0)