3 Replies Latest reply on Dec 7, 2018 11:38 AM by theblankbeard

    Text with auto resizing box issues

    theblankbeard Level 1
      I have an Auto sizing box I made but I am running into a little problem. I imagine their is a fix but my experience in expressions is limited, and my searching online has yet to yield any answers for me.





      Right now I have a rectangle shape layer that is the child of a text layer. The box automatically resizes with the text using sourceRectAtTime() and I have an offset paths for the padding. These text boxes are sitting in the bottom right and bottom left corners of a text-safe zone I have for the final video and I want to keep them there when I edit the text.



      Screen Shot 2018-12-06 at 1.34.04 PM.png



      I am easily able to keep the left and right edge there by simply changing the text to right or left justified depending on the side of the screen they are on, but if I add a line or add hanging letters (j, g, y etc.) then the bottom of the box drops out of text-safe.


      Screen Shot 2018-12-06 at 1.41.48 PM.png


      I also am running into the issue of keeping a paragraph that is center justified, on the left/bottom corner of text-safe. I imagine it would be the same solution as the previous question on keeping it pinned to the bottom, but the current expressions I'm using (same as the code at the bottom of this post) doesn't work for keeping it pinned to the left/right side of text-safe.



      Screen Shot 2018-12-06 at 1.51.42 PM.png



      Screen Shot 2018-12-06 at 1.52.01 PM.png



      Any links, tips, code or even hints would be greatly appreciated. I have the following expressions on the size and position of the rectangle paths.





      Rectangle path: size


             var s = thisComp.layer("Movie Title");
      var w = s.sourceRectAtTime().width;
      var h = s.sourceRectAtTime().height;


      Rectangle path: position


      var s = thisComp.layer("Movie Title");
      var w = s.sourceRectAtTime().width/2;
      var h = s.sourceRectAtTime().height/2;
      var l = s.sourceRectAtTime().left;
      var t = s.sourceRectAtTime().top;




        • 1. Re: Text with auto resizing box issues
          Mylenium Most Valuable Participant

          You need to add the widths and heights to the position rather than just absolutely setting it relative to the layer/ group.



          • 2. Re: Text with auto resizing box issues
            Kyle Hamrick Adobe Community Professional

            You just need to re-think the logic of this a little bit.


            If the corner of the box needs to be locked to a corner of your safe area, that's what should be driving the positioning, not the text.

            Box gets dimensions from text.
            Text is parented to box.
            Box anchor point is locked to bottom left/right corner of itself.
            Box position is locked to the bottom left/right corner of safe area.

            While it would certainly be possible to create one rig that does both left/right, I think it's much simpler to just make two setups, one for each side.


            (I added a few static expressions just to keep the positions locked in place/avoid accidental dragging.)


            Here's a rig that should work for the left, regardless of how much text you have in here. Let me know if you don't understand how to adapt it for the right side.



            Text Box Rig

            • 3. Re: Text with auto resizing box issues
              theblankbeard Level 1

              Thanks so much Kyle! That worked wonderfully. I was able to switch it to the right no problem.