ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Target content fill without using e.g. "content("Rectangle 1").content("Fill 1").color"?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Lenny Mason
Target content fill without using e.g. "content("Rectangle 1").content("Fill 1").color"?
on Dec 1, 2019 at 11:06:17 pm
Last Edited By Lenny Mason on Dec 2, 2019 at 1:40:28 am


I posted another question that is related to this subject today, but I felt like this question needed a seperate post. I'm working on a 'script' to add grain to objects. So far I've write the following expression:

if (effect("Lenny's Grain")("Shadow - Custom?") == 0 ? 100 : 0) {
c = effect("Lenny's Grain")("Fill");
hsl = rgbToHsl(c);
factor = effect("Lenny's Grain")("Shadow - Lightness") / 55;
newL = Math.min(hsl[2]*factor,1);
} else {
effect("Lenny's Grain")("Shadow - Color")

So, the shadow color is linked to a checkbox. If you turn the checkbox on, you can pick your own color. If you turn the checkbox off, the color will be adjusted to the fill color of a Color Overlay effect. This works fine, but I'd rather NOT use a color overlay. I'd rather make the color adjust to the original fill color of the layer, so the fill color that belongs to its content.

Obviously, I could change the code to:

c = content("Rectangle 1").content("Fill 1").color

But, that would mean that the shape has to be a rectangle. Is there another way to target the contents' Fill color?

Return to posts index

Andrei Popa
Re: Target content fill without using e.g. "content("Rectangle 1").content("Fill 1").color"?
on Dec 3, 2019 at 8:10:08 am

If you want to use your new line for any shape(not just a rectangle), just use and index instead of the name. Something like:

c = content(1).content("Fill 1").color

If you want to find out exactly what index that is, I suggest installing "GimmePropPath" script form Actually, if you want to continue doing scripting, you should definitely install that script.
Here's a link for a collection that contains GimmePropPath and a bunch of other really cool scripts.

My Envato portfolio.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved