Copy link to clipboard
Copied
Hi,
I've been searching high and low for a way to do this in illustrator for a while now. What I have is a vector graphic with many small pieces of jigsaw which form a perfect rectangle on 1 layer and an image on another layer (below). What I would like to do is - using whatever method, have each jigsaw piece on a separate layer with the corresponding part of the image inside the jigsaw puzzle piece so that I can move them about. I've been trying different selections of the pathfinder tool without success. What I am trying to avoid is the long a tedious method of releasing to layers (sequence) each jigsaw piece which is currently a path and then 1 by 1 cutting them out of the image individually which will take a very long time.
Any help will be greatly appreciated.
Thanks!
Jamie
I haven't got a proper jigsaw vector to try , so here's an untested and probably flawed idea ...
Start with just the jigsaw, filling the Artboard exactly
Place the image on the Artboard, so it too exactly fills it,
Embed the image and then drag the image alone into the Swatchs panel - to make a new swatch.
Delete the image on the Artboard
Select all the jigsaw pieces and give then a fill using the new swatch.
Assuming the pieces are ungrouped and separate objects they should take the correct part
...Found it:
//DESCRIPTION:Puzzlify
// A Jongware Script, 8-Oct-2010
myDlg = new Window('dialog', 'Puzzlify');
myDlg.orientation = 'column';
myDlg.alignment = 'right';
myDlg.add('statictext', undefined, "A Jongware Script 7-Oct-2010");
with (myDlg.add('group'))
{
orientation = 'row';
add('statictext', undefined, "Columns");
colTxt = add('edittext', undefined, "5");
colTxt.characters = 6;
}
with (myDlg.add('group'))
{
orientation = 'row';
add('statictext', undefined, "Rows");
rowTxt = add('
...
Copy link to clipboard
Copied
I haven't got a proper jigsaw vector to try , so here's an untested and probably flawed idea ...
Start with just the jigsaw, filling the Artboard exactly
Place the image on the Artboard, so it too exactly fills it,
Embed the image and then drag the image alone into the Swatchs panel - to make a new swatch.
Delete the image on the Artboard
Select all the jigsaw pieces and give then a fill using the new swatch.
Assuming the pieces are ungrouped and separate objects they should take the correct part of the image with them when moved..
Copy link to clipboard
Copied
Ray,
Excellent idea and I've just tried it. It works, but only to a certain extent and I don't think this will work properly. I did place and embed the image at the exact size of the art board as you suggested, and then when I applied the swatch - it is tiled and off-centred. I went into the swatch options to see if I could fix this and that led me nowhere.
Thanks for the suggestion though.
Copy link to clipboard
Copied
It works fine.
The Tiled and Off centered problem is probably caused because the origin of the Pattern swatch is at X:0 Y:0
But that can be fixed.
Double click the Selection tool in the Toolbox.
Deselect Transform Objects
Change the Horizontal and Vertical positions to move the pattern into place.
Copy link to clipboard
Copied
Very smart Ray!
Copy link to clipboard
Copied
Ton, thanks for clearing that up - just tried it and you are correct. That worked perfectly!
Thanks!
Copy link to clipboard
Copied
Jamie, can you give the "Correct" marking to Ray's brilliant answer?
Copy link to clipboard
Copied
There you go guys, Ray thanks for the genius method and Ton thanks for your input! Ray is marked correct now.
Copy link to clipboard
Copied
Good to hear your problem is solved.
Copy link to clipboard
Copied
Even better, use the Puzzlify script by Jongware in this thread:
Applying it to a pattern or symbol may be a good idea to reduce filesize.
Copy link to clipboard
Copied
Since that thread has evaporated in the new forum, here is the direct link to the script:
Copy link to clipboard
Copied
link down
Copy link to clipboard
Copied
Jongware has passed away few years ago. Maybe there is a version of the script still somewhere on the web. I could not find it. You could try and enter the URL in Archive.org.
Copy link to clipboard
Copied
Found it:
//DESCRIPTION:Puzzlify
// A Jongware Script, 8-Oct-2010
myDlg = new Window('dialog', 'Puzzlify');
myDlg.orientation = 'column';
myDlg.alignment = 'right';
myDlg.add('statictext', undefined, "A Jongware Script 7-Oct-2010");
with (myDlg.add('group'))
{
orientation = 'row';
add('statictext', undefined, "Columns");
colTxt = add('edittext', undefined, "5");
colTxt.characters = 6;
}
with (myDlg.add('group'))
{
orientation = 'row';
add('statictext', undefined, "Rows");
rowTxt = add('edittext', undefined, "5");
rowTxt.characters = 6;
}
with (myDlg.add('group'))
{
orientation = 'row';
traditionalRadio = add('radiobutton', undefined, "Traditional");
traditionalRadio.value = true;
randomRadio = add('radiobutton', undefined, "Random");
randomRadio.value = false;
}
with (myDlg.add('group'))
{
orientation = 'row';
scatterBox = add('checkbox', undefined, "Explode");
scatterBox.value = false;
deleteBox = add('checkbox', undefined, "Delete original");
deleteBox.value = true;
}
with (myDlg.add('group'))
{
orientation = 'row';
add('button', undefined, "OK");
add('button', undefined, "Cancel");
}
if (app.documents.length > 0 && app.selection.length == 1 && myDlg.show() == 1 && (colTxt.text || rowTxt.text))
{
sel = app.selection[0];
cols = Math.round(Number(colTxt.text));
rows = Math.round(Number(rowTxt.text));
if ((cols >= 1 && rows >= 1) || (cols == 0 && rows >= 1) || (cols >= 1 && rows == 0))
{
sel.selected = false;
if (cols == 0)
{
ratio = Math.abs((sel.geometricBounds[2]-sel.geometricBounds[0])/(sel.geometricBounds[3]-sel.geometricBounds[1]));
cols = Math.round(ratio*rows);
}
if (rows == 0)
{
ratio = Math.abs((sel.geometricBounds[3]-sel.geometricBounds[1])/(sel.geometricBounds[2]-sel.geometricBounds[0]));
rows = Math.round(ratio*cols);
}
posx = sel.geometricBounds[0];
posy = sel.geometricBounds[3];
width = (sel.geometricBounds[2]-sel.geometricBounds[0])/cols;
height = (sel.geometricBounds[3]-sel.geometricBounds[1])/rows;
// Constants for vertical nubs
oneThirdWide = width/3;
oneQuarterHigh = height/4;
// Constants for horizontal nubs
oneThirdHigh = height/3;
oneQuarterWide = width/4;
nubdir = new Array (rows);
if (randomRadio.value)
{
for (y=0; y<rows; y++)
{
nubdir[y] = new Array (cols);
for (x=0; x<cols; x++)
{
nubdir[y][x] = new Array(4);
// Top Y nub direction; true = up, false = down
nubdir[y][x][0] = (Math.random() < 0.5);
// Right X nub direction; true = right, false = left
nubdir[y][x][1] = (Math.random() < 0.5);
// Jitter value
nubdir[y][x][2] = height*(Math.random()-0.5)/10;
nubdir[y][x][3] = width*(Math.random()-0.5)/10;
}
}
} else
{
// Traditional:
for (y=0; y<rows; y++)
{
nubdir[y] = new Array (cols);
for (x=0; x<cols; x++)
{
nubdir[y][x] = new Array(4);
// Top Y nub direction; true = up, false = down
nubdir[y][x][0] = (x & 1) ^ (y & 1);
// Right X nub direction; true = right, false = left
nubdir[y][x][1] = !((x & 1) ^ (y & 1));
// Jitter value
nubdir[y][x][2] = height*(Math.random()-0.5)/10;
nubdir[y][x][3] = width*(Math.random()-0.5)/10;
}
}
}
for (y=0; y<rows; y++)
{
for (x=0; x<cols; x++)
{
// Make a new group
g = app.activeDocument.groupItems.add();
// Duplicate the selected object (and deselect it, while we have a handle)
sel.duplicate(g).selected = false;
// Create a path to make the clipping path
r = g.pathItems.add();
// Add top left point
addPoint (r, posx+x*width, posy-(y+1)*height);
if (y < rows-1)
{
if (nubdir[y+1][x][0])
{
// Add four points to get nub up on top side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-(y+1)*height-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+0.67*oneThirdWide, posy-(y+1)*height+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+1.33*oneThirdWide, posy-(y+1)*height-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-(y+1)*height-oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+1.33*oneThirdWide, posy-(y+1)*height-oneQuarterHigh-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+0.67*oneThirdWide, posy-(y+1)*height-oneQuarterHigh+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-(y+1)*height-oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+2.33*oneThirdWide, posy-(y+1)*height-oneQuarterHigh+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+1.67*oneThirdWide, posy-(y+1)*height-oneQuarterHigh-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-(y+1)*height-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+2.33*oneThirdWide, posy-(y+1)*height+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+1.67*oneThirdWide, posy-(y+1)*height-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
} else
{
// Add four points to get nub down on top side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-(y+1)*height-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+0.67*oneThirdWide, posy-(y+1)*height-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+1.33*oneThirdWide, posy-(y+1)*height+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-y*height-3*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+1.33*oneThirdWide, posy-y*height-2.5*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+0.67*oneThirdWide, posy-y*height-3.5*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-y*height-3*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+2.33*oneThirdWide, posy-y*height-3.5*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+1.67*oneThirdWide, posy-y*height-2.5*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-(y+1)*height-nubdir[y+1][x][2] ];
curvept.rightDirection = [ posx+x*width+2.33*oneThirdWide, posy-(y+1)*height-0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.leftDirection = [ posx+x*width+1.67*oneThirdWide, posy-(y+1)*height+0.33*oneQuarterHigh-nubdir[y+1][x][2] ];
curvept.pointType = PointType.SMOOTH;
}
}
// Add top right point
addPoint (r, posx+(x+1)*width, posy-(y+1)*height);
if (x < cols-1)
{
if (nubdir[y][x+1][1])
{
// Add four points to get nub right on right side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+4*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2.33*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2.33*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+5.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+5.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.33*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-0.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+4*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.33*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-0.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
} else
{
// Add four points to get nub left on right side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+4*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.67*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+3*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+2.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.67*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-2.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+3*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+2.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.33*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-0.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+4*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+4.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-0.67*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+3.5*oneQuarterWide-nubdir[y][x+1][3], posy-y*height-1.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
}
}
// Add bottom right point
addPoint (r, posx+(x+1)*width, posy-y*height);
if (y > 0)
{
// Add four points to get nub up on bottom side
if (nubdir[y][x][0])
{
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-y*height-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+2.33*oneThirdWide, posy-y*height+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+1.67*oneThirdWide, posy-y*height-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-y*height-oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+2.33*oneThirdWide, posy-y*height-oneQuarterHigh+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+1.67*oneThirdWide, posy-y*height-oneQuarterHigh-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-y*height-oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+1.33*oneThirdWide, posy-y*height-oneQuarterHigh-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+0.67*oneThirdWide, posy-y*height-oneQuarterHigh+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-y*height-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+0.67*oneThirdWide, posy-y*height+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+1.33*oneThirdWide, posy-y*height-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
} else
{
// Add four points to get nub down on top side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-y*height-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+2.33*oneThirdWide, posy-y*height-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+1.67*oneThirdWide, posy-y*height+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+2*oneThirdWide, posy-y*height+oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+1.67*oneThirdWide, posy-y*height+1.5*oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+2.33*oneThirdWide, posy-y*height+0.5*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-y*height+oneQuarterHigh-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+0.67*oneThirdWide, posy-y*height+0.5*oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+1.33*oneThirdWide, posy-y*height+1.5*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneThirdWide, posy-y*height-nubdir[y][x][2] ];
curvept.rightDirection = [ posx+x*width+0.67*oneThirdWide, posy-y*height-0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.leftDirection = [ posx+x*width+1.33*oneThirdWide, posy-y*height+0.33*oneQuarterHigh-nubdir[y][x][2] ];
curvept.pointType = PointType.SMOOTH;
}
}
// Add bottom left point
addPoint (r, posx+x*width, posy-y*height);
if (x > 0)
{
if (nubdir[y][x][1])
{
// Add four points to get nub right on left side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-nubdir[y][x][3], posy-y*height-oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.33*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-0.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneQuarterWide-nubdir[y][x][3], posy-y*height-1*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+1.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.33*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-0.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width+oneQuarterWide-nubdir[y][x][3], posy-y*height-2*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-2.33*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+1.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-nubdir[y][x][3], posy-y*height-2*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-2.33*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
} else
{
// Add four points to get nub left on left side
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-nubdir[y][x][3], posy-y*height-oneThirdHigh ];
curvept.leftDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-0.67*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-oneQuarterWide-nubdir[y][x][3], posy-y*height-1*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-0.67*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width-1.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-oneQuarterWide-nubdir[y][x][3], posy-y*height-2*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-2.33*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width-1.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.67*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
var curvept = r.pathPoints.add();
curvept.anchor = [ posx+x*width-nubdir[y][x][3], posy-y*height-2*oneThirdHigh ];
curvept.leftDirection = [ posx+x*width-0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-1.67*oneThirdHigh ];
curvept.rightDirection = [ posx+x*width+0.5*oneQuarterWide-nubdir[y][x][3], posy-y*height-2.33*oneThirdHigh ];
curvept.pointType = PointType.SMOOTH;
}
}
// Close the path. Neatness First.
r.closed = true;
// This group is clipped
g.clipped = true;
// Move away from the rest?
if (scatterBox.value)
{
var moveMatrix = app.getTranslationMatrix( width*(x-(cols/2))/2, -(height*(y-(rows/2))/2) );
g.transform( moveMatrix );
}
// Add to current selection
g.selected = true;
}
}
if (deleteBox.value)
sel.remove();
}
} else
myDlg.hide();
function addPoint (obj, x, y)
{
var np = obj.pathPoints.add();
np.anchor = [x,y];
np.leftDirection = [x,y];
np.rightDirection = [x,y];
np.pointType = PointType.CORNER;
}
Copy link to clipboard
Copied
"Applying it to a pattern or symbol may be a good idea to reduce filesize."
Applying it to an object filled with a single Pattern tile is still a good idea, but the Symbol idea does not work in CC 2020, it will embed an instance of the image for each puzzle piece, blowing up the file size.
Edit: use a Static Symbol to refer to a single instance.