-
Notifications
You must be signed in to change notification settings - Fork 0
/
LC_Trim Paths to Shape Layer.jsx
55 lines (37 loc) · 1.39 KB
/
LC_Trim Paths to Shape Layer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//Trim Paths to Shape Layer
/*
This adds a trim path to selected Shape Layers
It animates from 0%-100% on the end path property. Mainly just how I use it. Will look into adding some better interpolation to the keyframes rather than linear
*/
//Trim Paths to Shape Layer
//Trim Paths to Shape Layer
function addTrimPath() {
app.beginUndoGroup("Undo Guide");
if (app.project.activeItem == undefined || app.project.activeItem == null) {
alert("Please select a Comp / Shape Layer");
return false;
} else {
tp(app.project.activeItem.selectedLayers);
}
app.endUndoGroup();
}
function tp(layer) {
for (var i = 0; i < layer.length; i++) {
//Trim Path Property
var comp = app.project.activeItem;
var myLayer = app.project.activeItem.selectedLayers[i];
var effectsProperty = layer[i].property("ADBE Root Vectors Group");
var trimPath = effectsProperty.addProperty("ADBE Vector Filter - Trim");
var trimPathEnd = trimPath.property("ADBE Vector Trim End");
//Trim Path Keyframes
var applyEaseIn = new KeyframeEase(0,66);
var applyEaseOut = new KeyframeEase(0,66);
trimPathEnd.setValueAtTime(myLayer.inPoint,0);
trimPathEnd.setValueAtTime(myLayer.inPoint + 30 * comp.frameDuration,100);
trimPathEnd.setValueAtKey(1,0);
trimPathEnd.setValueAtKey(2,100);
trimPathEnd.setTemporalEaseAtKey(1,[applyEaseIn],[applyEaseOut]);
trimPathEnd.setTemporalEaseAtKey(2,[applyEaseIn],[applyEaseOut]);
}
}
addTrimPath();