Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Autoscale Text Box for two lines of text

  • Adam Greenberg

    November 3, 2023 at 1:22 pm

    here is the code for people who may stumble on this thread one day, to be applied to the path ( you need to add the path property to the rectangle of the shape layer )

    margin = 30;



    t2=thisComp.layer(“textLayer 2”);


    l = t1.toComp([s1.left,])[0] – margin;

    r = t2.toComp([s2.left+s2.width,])[0] + margin;

    t = Math.min(t1.toComp([s1.left,])[1], t2.toComp([s2.left+s2.width,])[1]) – margin;

    b = Math.max(t1.toComp([s1.left,])[1], t2.toComp([s2.left+s2.width,])[1]) + margin;

    y = thisComp.layer(“textLayer”).toComp([thisComp.layer(“textLayer”).sourceRectAtTime().left+thisComp.layer(“textLayer”).sourceRectAtTime().width,0],2)[0]+margin;

    z = thisComp.layer(“textLayer 2”).toComp([thisComp.layer(“textLayer 2”).sourceRectAtTime().left+thisComp.layer(“textLayer 2”).sourceRectAtTime().width,0],2)[0]+margin;

    x = Math.max(y,z);

    createPath( [fromComp([l,t]), fromComp([x,t]), fromComp([x,b]), fromComp([l,b])], [],[], true);

Page 2 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy