Puoi anche usare lo scripting. Per esempio, questo è il modo in cui puoi creare 20 elementi del percorso con rotazione e posizione casuale dal centro.
// creating a document
var doc = app.documents.add();
// adding a new layer
var layer = doc.layers.add();
// variable declarations
var i, ray, displacement, dx, dy;
// creating 20 path items in a loop and setting their parameters
for (i = 0; i < 20; i++) {
// adding a path item and saving it to the "ray" variable
ray = layer.pathItems.add();
// defining path points
ray.setEntirePath([[0, 0], [0, 10]]);
// generating a random angle for rotation
// note: rotation in Illustrator is counter-clockwise
ray.rotation = Math.round(Math.random() * 360);
// applying rotation to the path, using its bottom as the origin point
ray.rotate(ray.rotation, true, true, true, true, Transformation.BOTTOM);
// moving the path away from the center of the document by "displacement" amount
displacement = 10 + Math.random() * 10;
// calculating x and y coordinates from "displacement"
// (which is basically a hypotenuse)
dx = displacement * Math.sin( (180 + ray.rotation) * Math.PI / 180 );
dy = - displacement * Math.cos( (180 + ray.rotation) * Math.PI / 180 );
// translating the path
ray.translate(dx, dy);
}
Puoi poi salvarlo come “somefile.js” ed eseguirlo da File->Scripts->Altro script… Oppure incollarlo nel toolkit ExtendScript ed eseguirlo da lì.