1 Reply Latest reply on Jul 7, 2017 8:04 AM by kurnikoff

    Expressions problem with offsetting position of layer B vs layer A



      I am building a Essential Graphics text template and I need to attach B layer to corner of A layer + offset it downwards.

      Let me explain:

      A layer is a text layer. I am using this expression to keep anchor point dead centre, even if text changes.

      R = thisLayer.sourceRectAtTime(time); T = R.top; L = R.left; W = R.width; H = R.height; [L+W/2,T+H/2] 

      Also, I am using this expression to keep the position of text layer A fixed at all times:

      var w=thisComp.width; var h=thisComp.height; var w2=w/2; var h2=h/6; [w2,h2*2] 

      So far so good. Stuff works. Now, the part I have problem with is to adjust position of layer text B, based on a textbox of a layer A. I want it to be offset dynamically. At the moment, the expressions I managed to come up with work, but then when I add or remove characters to text layer A, it gets messed up.

      boxHeight =thisComp.layer("Text layer A.").sourceRectAtTime(time).height; boxWidth = thisComp.layer("Text layer A.").sourceRectAtTime(time).width; boxLeft = thisComp.layer("Text layer A.").sourceRectAtTime(time).left; [-boxLeft,boxHeight]; 

      Short version: how can I attach layer B to the bottom left corner of a layer A + offset it downward by 20 pixels?

      Any ideas?