Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Reference value inside Shape Layer Group (independant of hirarchy)

  • Reference value inside Shape Layer Group (independant of hirarchy)

    Posted by Padraic Rapp on August 1, 2018 at 8:52 am

    So I have a Shape Layer with a “Group 1” that contains a path, a “Fill 1” and a “Stroke 1”.
    I want to duplicate “Group1” a bunch of times and generate a random fill for every clone. the stroke should be white except when the fill is white, then the stroke would be randomly colored.

    the color value of “Fill 1” is randomly generated whenever I duplicate the Group. Like this


    colors=
    [[1,0.1,0.14,1],
    //AND SOME MORE COLORS
    ];

    shapeIndex=thisProperty.propertyGroup(3).name.split(" ")[1];
    seedRandom(shapeIndex, true);

    idx1 = Math.floor(random(colors.length));
    colors[idx1]

    this is referencing the property index so I can duplicate the group to generate a random color for each clone.

    Now I want to reference the “Fill 1” inside of “Stroke 1”. This is how far I’ve gotten:


    if(content(thisProperty.propertyGroup(2).name.split(" ")).content("Fill 1").color==[1,1,1,1])
    {

    colors=
    [[1,0.1,0.14,1],
    //AND SOME MORE COLORS
    ];

    shapeIndex=thisProperty.propertyGroup(3).name.split(" ")[1];
    seedRandom(shapeIndex, timeless = true);

    idx1 = Math.floor(random(colors.length));
    content("Group 1").content("Stroke 1").color=colors[idx1]

    }
    else
    {

    [1,1,1,1]

    };

    The “if” condition gives me the problem here.
    QUESTION
    what’s the correct syntax here to reference the parent group’s fill color?

    Thank you so much for reading, let me know if anything isn’t perfectly understandable.

    Paddy

    Credits to stib from stackexchange, his post got me half the way to where I wanted to be:
    https://video.stackexchange.com/questions/15237/vary-the-color-of-repeated-shape-in-after-effects

    Padraic Rapp replied 8 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 1, 2018 at 1:16 pm

    If the Fill and the Stroke are in the same group, from the Stroke color, this should give you the FIll color:

    thisProperty.propertyGroup(2)(“Fill 1”)(“Color”)

    or this way, if you want to use match names:

    thisProperty.propertyGroup(2)(“ADBE Vector Graphic – Fill”)(“ADBE Vector Fill Color”)

    Dan

  • Padraic Rapp

    August 2, 2018 at 10:36 am

    And Dan makes another life better! Thank you so much!

    I was on the right track with propertyGroup and so on but I had no idea you could target the color value like that (“Color”)

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