Skip to main content
Community Expert
January 28, 2019
Respondido

Property Group and index problem.

  • January 28, 2019
  • 1 resposta
  • 1468 Visualizações

I have a shape layer with dozens of rectangles on the same shape layer. I need to take the comp width and height divided by two and subtract the Transform Rectangle position so I get a value for the actual position of the rectangle in comp space. Then I use that value in the opacity property of that rectangle combined with sampleImage to control the opacity of the layer. The goal is to put a stroked path layer below the rectangle layer, add trim paths, then when. the stroke passes the rectangle the opacity of that rectangle goes to zero.

Here is an example of the expression applied to the Transform Rectangle 1 opacity property, and it is working just fine:

target = thisComp.layer(index + 1);

CP = [thisComp.width/2, thisComp.height/2] - content("Rectangle 1").transform.position;

alpha = target.sampleImage(CP, [.5, .5])[3];

alpha * 100

I've already referenced the target layer as the first layer below the triangle layer so an animation preset will not break because of layer names. What I want to do is use the propertyIndex to refer to content("Rectangle 1).transform.position so that I can duplicate the Rectangle or add any other shape to the layer and add the expression without having to enter the content('Shape Name') manually or with a pickwhip.

I've tried every combination of propertyIndex and propertyGroup that I can think of. I can get the CP to point to the position of another rectangle using propertyGroup and drilling up, but I can't seem to get the Opacity to find the Position property in the same group. I'm hoping that Dan or some other master will have the answer.

Let me know if you need any other info.

Este tópico foi fechado para respostas.
Melhor resposta por Dan Ebberts

Hi Rick,

>I can't seem to get the Opacity to find the Position property in the same group

Is this what you're after?

pos = thisProperty.propertyGroup(1)("Position");

Dan

1 Resposta

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertResposta
Community Expert
January 28, 2019

Hi Rick,

>I can't seem to get the Opacity to find the Position property in the same group

Is this what you're after?

pos = thisProperty.propertyGroup(1)("Position");

Dan

Community Expert
January 28, 2019

Dan, you are the man...

I was missing thisProperty. The expression language guide needs some serious updating.