ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Reference value inside Shape Layer Group (independant of hirarchy)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Padraic Rapp
Reference value inside Shape Layer Group (independant of hirarchy)
on Aug 1, 2018 at 8:52:14 am
Last Edited By Padraic Rapp on Aug 1, 2018 at 8:53:56 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(<b>content(thisProperty.propertyGroup(2).name.split(" ")).content("Fill 1").color==[1,1,1,1]</b>)
{
<blockquote>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]</blockquote>
}
else
{
<blockquote>[1,1,1,1]</blockquote>
};


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-...


Return to posts index

Dan Ebberts
Re: Reference value inside Shape Layer Group (independant of hirarchy)
on Aug 1, 2018 at 1:16:39 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



Return to posts index

Padraic Rapp
Re: Reference value inside Shape Layer Group (independant of hirarchy)
on Aug 2, 2018 at 10:36:38 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")


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]