ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Add values to proximity based expression

FAQ   •   VIEW ALL
 Add values to proximity based expression on Jul 1, 2019 at 4:33:34 pm

So, I'm trying to make a square shape layer scale down to 0 once it passes thru a text, so it doesnt cover the text up.

I've got this expression:

```t = length(position, thisComp.layer("Text").position); s = ease(t, 200, 0, 0, 100); [s, s] ```
But it only references the text's anchor point, which is in the center. My problem is the square shape layer is multiple (lots of squares going thru) and they will come on a 45 degree angle. So if I adjust the distance from the anchor point which the scaling will begin horizontally, the vertical distance gets too large, and vice versa (except it gets too small for the horizontal once I adjust the distance based on the vertical).

I've figured that if I make 4 layers of the same text, each with an anchor point in the extremities (up, down, right, left) and managed to reference each anchor point to the proximity scaling, it should work the way I wanted, but I dont know how to use 4 values in this expression.

Except the brackets doesnt work. Anyone can give me a light? Maybe there is another way to do it that I`m missing. Sorry for any stupid questions, I`m new to the expressions world...

 Re: Add values to proximity based expressionon Jul 1, 2019 at 9:39:51 pm

Not sure tour 3 text way is the best, but in a lack of solutions, here we go. I think this should work.

```len1 = length(position, thisComp.layer("Text1").position); len2= length(position, thisComp.layer("Text2").position); len3 = length(position, thisComp.layer("Text3").position); len4 = length(position, thisComp.layer("Text4").position); t = Math.min(len1, len2, len3, len4); s = ease(t, 200, 0, 0, 100); [s, s]```

Andrei
My Envato portfolio.