Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Size of text to be size of comp

  • Size of text to be size of comp

    Posted by Andrew Ross on February 6, 2020 at 10:40 am

    Hi there

    I have lots of text captions to render off as still frames and then an editor is going to be using them to overlay in an edit

    I want to make the process as streamlined as possible, so I am using the thisComp.name to make the naming process easier but i was wondering if there is any way using an expression in the scale property, to make the text as large as it can be in the composition, no matter what the text is changed to, keeping it’s proportions in order for the editor to have the largest text possible to reposition and rescale as needed.

    So the process i want is as follows: Create a new comp, call the new comp for example GRAPHIC ONE. The expression would make the text as big as it can be in the composition whilst maintaining proportions and without any cropping. Next I would duplicate GRAPHIC ONE comp in the project panel and rename it, for example, to YES. The expression would then automatically scale the YES text to fill the frame as much as it can without cropping and so on. This way, all i need to do is rename the comps in the project panel and then render rather than having to go in to each comp to resize the layer.

    I’ve stumbled across similar posts and some that i think could work with a bit of adaption but my scripting skills aren’t anywhere near what they need to be at, in order to adapt an existing expression in to something that works for me.

    Thanks in advance

    Andrew Ross replied 6 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Tomas Bumbulevičius

    February 7, 2020 at 6:28 am

    Hey Andrew,

    do the following steps:

    1. Apply expression to anchor point on the text layer:

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

    2. To make sure text is always in center, add this for position expression:

    H = thisComp.height;
    W = thisComp.width;
    [W/2, H/2]

    3. Apply expression for scaling:

    layerW = thisLayer.sourceRectAtTime(time).width;
    compW = thisComp.width;
    maxW = compW;
    s = maxW / layerW * 100;
    [s,s]

    Assuming you have thisComp.name in text’s source, it will work regardless of text size. This works well enough from 3characters length. If shorter, it will exceed top boundaries and would require extra few lines into consideration. Good luck!

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Andrew Ross

    February 10, 2020 at 12:00 pm

    Tomas my friend you are a complete genius thank you.

    There will be no need to go below three letters so what you have supplied above works absolutely fantastically.

    Thank you so much : )

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