Forum Replies Created

  • Martin Brunner

    November 3, 2023 at 8:05 am in reply to: Autoscale Text Box for two lines of text

    Awesome! Thank you very much for your time and effort!

  • Martin Brunner

    November 2, 2023 at 4:57 pm in reply to: Autoscale Text Box for two lines of text
  • Martin Brunner

    November 2, 2023 at 4:27 pm in reply to: Autoscale Text Box for two lines of text

    Hi Adam

    Thanks! I tried but I am not sure if I interpreted it right. I applied the Math.max to the variabale r in the last bit of the expression, which doesn’t give me a solution…

    margin = 30;
    t1=thisComp.layer(“textLayer”);
    s1=t1.sourceRectAtTime();
    t2=thisComp.layer(“textLayer 2”);
    s2=t2.sourceRectAtTime();
    l = t1.toComp([s1.left, s1.top])[0] – margin;
    r = t2.toComp([s2.left+s2.width, s1.top])[0] + margin;
    t = Math.min(t1.toComp([s1.left, s1.top])[1], t2.toComp([s2.left+s2.width, s2.top])[1]) – margin;
    b = Math.max(t1.toComp([s1.left, s1.top+s1.height])[1], t2.toComp([s2.left+s2.width, s2.top+s2.height])[1]) + margin;
    createPath( [fromComp([l,t]), fromComp([Math.max(l,r),t]), fromComp([Math.max(l,r),b]), fromComp([l,b])], [],[], true);

    Did I miss something?

  • Martin Brunner

    November 2, 2023 at 8:56 am in reply to: Autoscale Text Box for two lines of text

    Update:

    I found the following expressions which works fine for the text box to adapt to first line of text.

    margin = 30;
    t1=thisComp.layer(“textLayer”);
    s1=t1.sourceRectAtTime();
    t2=thisComp.layer(“textLayer 2”);
    s2=t2.sourceRectAtTime();
    l = t1.toComp([s1.left, s1.top])[0] – margin;
    r = t2.toComp([s2.left+s2.width, s1.top])[0] + margin;
    t = Math.min(t1.toComp([s1.left, s1.top])[1], t2.toComp([s2.left+s2.width, s2.top])[1]) – margin;
    b = Math.max(t1.toComp([s1.left, s1.top+s1.height])[1], t2.toComp([s2.left+s2.width, s2.top+s2.height])[1]) + margin;
    createPath( [fromComp([l,t]), fromComp([r,t]), fromComp([r,b]), fromComp([l,b])], [],[], true);

    So if I am assuming correctly I would have to replace the expression for r with an expression that looks at the width of both text layers? Would anyone know how to do that? THX

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