Search code examples
objectrandomrotationadobe-illustrator

randomly rotate objects in adobe illustrator


How to randomly rotate objects in Adobe illustrator. I wanted to ask you that how I could rotate many selected objects which are at the same angle and rotate them at random angle.

Script for adobe illustrator in javascript.


Solution

  • Your selected objects it's just an array in Document.selection, so:

    var min = Number(prompt("Minimum angle?","0"));
    var max = Number(prompt("Maximum angle?","360"));
    
    for(var i in activeDocument.selection){
        var angle = Math.floor(Math.random() * (max - min + 1)) + min;
        activeDocument.selection[i].rotate(angle);
    }