-
Notifications
You must be signed in to change notification settings - Fork 56
/
addRoundedShape.jsx
36 lines (28 loc) · 1.29 KB
/
addRoundedShape.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
35
36
/*
Just adds a blank shape object with rounded Line Cap and Line Join
Exclusively for Al Medwedsky
CC-BY, Nik Ska, 2014
*/
var addRoundedShape = function(){
var activeComp = app.project.activeItem;
if(activeComp && activeComp instanceof CompItem){
var sel = activeComp.selectedLayers; //selected layers
app.beginUndoGroup("Add a rounded shape");
var newShape = activeComp.layers.addShape();
var shapeGroup = newShape.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Group");
var shapeFill = shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Fill");
shapeFill.enabled = false;
var shapeStroke = shapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
shapeStroke.property("ADBE Vector Stroke Line Cap").setValue(2);
shapeStroke.property("ADBE Vector Stroke Line Join").setValue(2);
if(sel){ //if anything is selected
sel.sort(function(a,b){ //sort by index
return a.index - b.index;
});
newShape.moveBefore(sel[0]); //placing before the 1st
};
app.endUndoGroup();
}
}
addRoundedShape();