Copy link to clipboard
Copied
Hi all,
I have a static range of percentages I want to convert the opacity of a specific layer with. Each frame has a different opacity, 504 frames. How do I add those? It shouldn't be hard I think, but I just need a bit of code I think?
Here is an example range:
| 70% | 77% | 81% | 84% | 86% | 86% | 86% | 86% | 86% | 87% | 87% | 87% | 87% | 87% | 87% | 87% | 87% | 87% | 87% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 86% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 85% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 84% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 83% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 82% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 81% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 80% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 79% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 78% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 77% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 76% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% | 75% |
Copy link to clipboard
Copied
You can make a JSON file like the ones attached that places all the opacity values in an array. Import that file into After Effects and place it at the bottom of your comp. Then on your layer's opacity property, add the expression
[ UPDATED ]
thisComp.layer("opacity.json")("Data")("Outline")(timeToFrames(time) + 1)
which will grab the value in the array value for each frame (1st frame = 70%, 2nd frame = 77%, etc)
Copy link to clipboard
Copied
Thanks Rick, read that section wrong, updated the expression above.
Copy link to clipboard
Copied
This looks like a nonlinear change in opacity. The easiest way is with a JSON file but you want to apply it to frames instead of layers.
If you want a specific linear change over time you can just use a simple expression like this:
t = time * thisComp.frameDuration;
tMin = 0;
tMax = 504;
value1 = 70;
value2 = 40;
linear(t, tMin, tMax, value1, value2);
It would really help us help you if we knew the design goal you had. I'm having a hard time visualizing what you are trying to accomplish. There may be a lot simpler approach.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more