Skip to main content
S_ A
Inspiring
Oct 4, 2025 9:25 AM UTC
Answered

how to write expression in such case-17 (position + opacity)

Hi,

 

I want to control the opacity of a layer by the position of another layer. I dnt know why my expression is not working. Please correct me where I am making mistakes. Thank you.

 

I want the eye corner to be visible only when the eyes moved to teh last positinon (here 990,403), before this it's opacity will be zero, 

 

Thank you.

 

 

S_ A
S_ ACorrect answer
Inspiring
Oct 5, 2025 11:22 AM UTC

Thank you so much. 

4 replies

Community Expert
Oct 4, 2025 2:31 PM UTC

Assuming that the Face layer is an ellipse with the anchor point in the center of the ellipse, it is below the Shadow layer, and the Anchor Point of the Shadow layer is at the center of the shadow on the right, this expression should give you the results you want. 

Adjusting the offset with a Slider controls the timing of the fade-in for the shadow layer.

ofst = effect("Slider Control")("Slider"); // adjust value to time fade in
sp = position[0];
face = thisComp.layer(index + 1);
fSiz = face.content("Ellipse 1").content("Ellipse Path 1").size[0]/2;
fPos = face.position[0] + fSiz;
ofst + fPos - sp;

The expression compares the position of the Face layer + the radius of the face with the position of the Shadow layer plus an offset value so the shadow appears with a quick fade in as the face moves into position. Adjusting the offset value will control the timing. It's more complicated than Dan's solution, but it gives you a quick fade-in for the shadow layer. 

Translate
S_ A
S_ AAuthor
Inspiring
Oct 5, 2025 11:23 AM UTC

😮 wow! Thank you so much for teaching me this! I never knew!!

Translate
Dan Ebberts
Community Expert
Community Expert
Oct 4, 2025 12:51 PM UTC

I think you just need to change the second line to this:

j[0] < 999 ? 0 : 100
Translate
S_ A
S_ AAuthorCorrect answer
Inspiring
Oct 5, 2025 11:22 AM UTC

Thank you so much. 

Translate