Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Random brush stroke

$
0
0

I download this script that randomly fill all selected paths with the selected swatches:

 

mySelection = app.activeDocument.selection;
myDoc = app.activeDocument;
if (mySelection instanceof Array)
{
selSwatches = myDoc.swatches.getSelected();

if(selSwatches.length != 0)
for (i=0; i<mySelection.length; i++)
{
if(mySelection[i].typename == "PathItem" || mySelection[i].typename == "CompoundPathItem")
{
selItem = mySelection[i];
selItem.filled = true;


swatchIndex = Math.round( Math.random() * (selSwatches.length - 1 ));

if(selItem.typename == "PathItem")
selItem.fillColor = selSwatches[swatchIndex].color;
else
selItem.pathItems[0].fillColor = selSwatches[swatchIndex].color;

}
}
}

 

I would like to adapt it to stroke randomly with all selected brushes

 


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>