: Fluid shape resize in Illustrator, Photoshop or InDesign Is it possible to resize a group of shapes and keep the distance locked between them? I've tried this in Photoshop, Illustrator, InDesign,
Is it possible to resize a group of shapes and keep the distance locked between them? I've tried this in Photoshop, Illustrator, InDesign, Muse, Sketch but with no success. Maybe there is a plugin for that?
More posts by @Sarah814
2 Comments
Sorted by latest first Latest Oldest Best
Here is a script for Illustator that will do this to a user-entered width. For simplicity, I've only written it for horizontal resizing, and it only works if the items are in a group which is the first selection.
#target illustrator
var group = activeDocument.selection[0];
var toWidth = prompt ("Resize to width (pts):", Math.ceil (group.width));
if (group.typename == "GroupItem") {ResizePreserveMargins (group, toWidth);}
function ResizePreserveMargins (group, toWidth)
{ var count, i, items, item, margins=[], width=toWidth, margin, x=0;
items = SortLeftToRight (group.pageItems);
count = items.length;
for (i=0; i<count-1; i++)
{ item = items[i];
margin = items[i+1].left - item.left - item.width;
margins.push (margin);
width -= margin + item.width;
}
width -= items[count-1].width;
for (i=0; i<count; i++)
{ item = items[i];
if (i) {item.left = x + margins[i-1];}
item.width += width/count;
x = item.left + item.width;
}
}
function SortLeftToRight (items)
{ var lefts=[], sorts=[], i, j, count, count2, item;
count = items.length;
// Gather & sort item left values
for (i=0; i<count; i++) {lefts.push (items[i].left);}
lefts.sort (function (a,b) {return a-b;});
// Add left-to-right sorted items to final list
for (i=0; i<count; i++)
{ item = items[i];
count2 = lefts.length;
for (j=0; j<count2; j++)
{ if (items[i].left == lefts[j])
{ sorts.push (item);
lefts.splice (j,1);
break;
}
}
}
return sorts.reverse ();
}
You can manually redistribute the spacing in a few clicks easily enough:
That will move objects to adjust the spacing though so that's not ideal.
Other than that your best option is probably to use some appearance attribute to create the offset and align the objects themselves with no space...
So in Illustrator with an Offset Path effect on the fill of the shapes for an example:
After resizing (make sure Scale Strokes & Effects is turned off):
You could do this with any number of attributes depending on your use case; a stroke, an offset path, inset spacing in InDesign, etc. The point is to keep the spacing as an attribute separate from the objects relative positioning.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.