ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Position from two layers, plannar positioning

FAQ   •   VIEW ALL
 Position from two layers, plannar positioning on Jan 25, 2017 at 3:31:10 am

I found a Fusion expression that I would like to know how to implement in Ae if possible.
It requires two point that can then be used interpolate a 3rd point that is adjustable.
It would be very useful for tracking.
The Fusion expression and example can be found here;

Thanks kindly.

 Re: Position from two layers, plannar positioningon Jan 25, 2017 at 6:32:57 pm

I'm not sure how you want to implement this in AE, but it might be as simple as an expression like this:

s = effect("Slider Control")("Slider");
a = thisComp.layer("A").transform.position;
b = thisComp.layer("B").transform.position;
linear(s,0,100,a,b)

Dan

 Re: Position from two layers, plannar positioningon Jan 25, 2017 at 8:01:51 pm

Setup:

P3 layer has Slider Control renamed to "weight" and adjusted value to 0 to 1

Expressions for copy-paste:

Weight Text - Source Text:
``` w = Math.round(thisComp.layer("P3").effect("weight")("Slider") * 100) / 100; "w=" + w; ```

Weight Text - Position (used anchor point for positioning):
``` thisComp.layer("P3").transform.position ```

P3 (3rd Point) - Position:
``` w = effect("weight")("Slider"); p1 = thisComp.layer("P1").transform.position; p2 = thisComp.layer("P2").transform.position; x = ((1 - w) * p1[0]) + (w * p2[0]); y = ((1 - w) * p1[1]) + (w * p2[1]); [x, y]; ```

Beam Effect - Starting Point:
``` thisComp.layer("P1").transform.position ```

Beam Effect - End Point:
``` thisComp.layer("P2").transform.position ```

 Re: Position from two layers, plannar positioningon Jan 26, 2017 at 9:01:51 am

Emre Anil,

Thank you so much for taking the time to post your solution, which works perfectly :-).
This will be very useful.

Kind Regards,

Tim