//Make a mess! //Aaron Beall - http://abeall.com if(fw.selection.length==0){ alert('Select at least one Object to randomize.'); }else{ var dom = fw.getDocumentDOM(); var allProps = fw.yesNoDialog('Randomize opacity, rotation, and position?\nPress [Yes] to randomize all properties. \nPress [No] to choose specific properties to randomize.\n\nTIP: Object position is randomized within the current selection rectangle, not the entire document.'); var rand = new Array(); if(allProps){ rand = [true,true,true,true,true,true]; }else{ rand[0] = fw.yesNoDialog('Randomize opacity?'); rand[1] = fw.yesNoDialog('Randomize rotation?'); rand[2] = fw.yesNoDialog('Randomize X position?'); rand[3] = fw.yesNoDialog('Randomize Y position?'); rand[4] = fw.yesNoDialog('Randomize Scale(0-100 percent)?'); if(rand[4]) rand[5] = fw.yesNoDialog('Lock X and Y Scale?'); } var sel = new Array().concat(fw.selection); var bounds = dom.getSelectionBounds(); for(var i in sel){ fw.selection = new Array(sel[i]); if(rand[0])dom.setOpacity(Math.random()*100); var xpos = rand[2] ? Math.round((bounds.right-bounds.left-sel[i].width)*Math.random()) : false; var ypos = rand[3] ? Math.round((bounds.bottom-bounds.top-sel[i].height)*Math.random()) : false; if(xpos || ypos) dom.moveSelectionTo({x:bounds.left+xpos, y:bounds.top+ypos}, false, false); if(rand[1])dom.rotateSelection(360*Math.random(),'transformAttributes'); var xscale = rand[4] ? Math.random() : 1; var yscale = rand[4] ? (rand[5]?xscale:Math.random()) : 1; dom.scaleSelection(xscale,yscale,'autoTrimImages transformAttributes') sel[i] = fw.selection[0]; } fw.selection = sel; }