-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathParent_Opacity.jsx
30 lines (29 loc) · 1.12 KB
/
Parent_Opacity.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
/**
* @name Parent Opacity
* @version 1.0
* @author Kyle Martinez <www.kyle-martinez.com>
*
* @description Connect the opacity of a layer to the opacity of the parent layer. Both opacity
* properties can be animated individually however the lowest opacity value will always be used.
*
* @license This script is provided "as is," without warranty of any kind, expressed or implied. In
* no event shall the author be held liable for any damages arising in any way from the use of this
* script.
*
* I'm just trying to help make life as an After Effects animator a little easier.
*/
(function parentOpacity() {
var expression = "Math.min(value, thisLayer.parent.transform.opacity.value);";
app.beginUndoGroup("Parent Opacity");
var comp = app.project.activeItem;
var layers = comp.selectedLayers;
var numLayers = layers.length;
for (var l = 0; l < numLayers; l++) {
var layer = layers[l];
if (layer.parent) {
var opacity = layer.property("ADBE Transform Group").property("ADBE Opacity");
opacity.expression = expression;
}
}
app.endUndoGroup();
})();