-
Notifications
You must be signed in to change notification settings - Fork 56
/
mixIt.jsx
34 lines (24 loc) · 1.04 KB
/
mixIt.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//MixIt! Remixes layers based on thier position
//CC-BY, Nik Ska, 2015
var activeComp = app.project.activeItem;
if(activeComp && activeComp instanceof CompItem){
var sel = activeComp.selectedLayers;
if(sel.length > 0){
app.beginUndoGroup("Remix");
var posArray = [];
//creating anchor point - pos array
for(var s = 0; s < sel.length; s++){
posArray.push([sel[s].property("ADBE Transform Group").property("ADBE Anchor Point").value, sel[s].property("ADBE Transform Group").property("ADBE Position").value]);
}
var i = posArray.length;
while(i > 0){
var rand = parseInt(Math.random()*i); //getting random index
//setting its pos and ap
sel[i-1].property("ADBE Transform Group").property("ADBE Anchor Point").setValue(posArray[rand][0]);
sel[i-1].property("ADBE Transform Group").property("ADBE Position").setValue(posArray[rand][1]);
posArray.splice(rand, 1);
i--;
}
app.endUndoGroup();
}
}