Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Target content fill without using e.g. “content(“Rectangle 1”).content(“Fill 1″).color”?

  • Target content fill without using e.g. “content(“Rectangle 1”).content(“Fill 1″).color”?

  • Lenny Mason

    December 1, 2019 at 11:06 pm


    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?

  • Andrei Popa

    December 3, 2019 at 8:10 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.

Viewing 1 - 2 of 2 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy