Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Understanding Text Tracking(letters spacing) through expressions

  • Understanding Text Tracking(letters spacing) through expressions

  • Tomas Bumbulevičius

    August 19, 2021 at 9:45 am

    Hey guys, did anyone find a logical relation between how tracking of letters affects layer size? It seems to be letters dependant, thus I am wrapping my head around how to adjust tracking dynamically.

    I kind of thought to make required changes to the text, setTracking through style, and gather the new text width. However, thats not how it works, nor I find a logical ratio of how much pixels tracking increments adds.

    Any suggestions how to approach setting the tracking, that text width would be drawn by other layer? Think of it like two text phrases, where shorter one adapts to longer by increasing tracking and vice versa. I might overthinking this at the roadblock.

    Thanks!

  • Dan Ebberts

    August 19, 2021 at 7:44 pm

    Tomas, I’m not sure what you’re asking exactly, but it looks like tracking adds that many pixels to the space between each pair of characters. So if tracking is 10 and the text is 9 characters, it will increase the width of the text by 80. However, if you’re trying to set the tracking by using that layer’s own sourceRectAtTime().width as part of the calculation, I think that may create some kind of deadlock conflict that will keep it from solving correctly. Not completely sure about that though.

  • Tomas Bumbulevičius

    August 26, 2021 at 4:42 pm

    Hey Dan, thanks for your response. I think you got it right! Example here could help, see intro in the beginning: https://www.instagram.com/p/CS7QKyPJoNK/

    On the left, there is a 90 degrees rotated phrase. The characters count in that line might change based on the topic, as well as the height of main topic title in orange (1-4 lines)

    You can see a different layout here: https://www.instagram.com/reel/CS7B6egjJ8E/

    In an ideal scenario, I want rotated phrase to always extend/contract based on height of phrase on the right.

    By simply setting tracking based on “tens” of value – doesn’t work, because this value is not consistent (based on characters and their width, I assume).

    Maybe there is a different way, but I only figured out this through applying tracking, either through expression to source, or via text animation engine. I still haven’t reached stable working solution, but will keep trying. If anyone else have a different approach for such thing – it would be amazing if you share your thought process. I can figure out from that how to do it, maybe its a matter of different angle of viewing at it 🙂 Thanks!

  • Dan Ebberts

    August 26, 2021 at 5:37 pm

    Yes, in that scenario you might expect something like this to work:

    h = thisComp.layer("TITLE").sourceRectAtTime(time,false).height;

    n = text.sourceText.value.length;

    w = sourceRectAtTime(time,false).width;

    (h - w)/(n-1)

    and, in fact, if you apply that expression to the tracking amount and hover your cursor over the rotated text, the bounding box does appear to match the height of the main title, but the text doesn’t get redrawn, presumably because you’re using an expression that depends on and then tries to alter its layer’s own sourceRectAtTime. If you figure out a solution, please post it.

  • Tomas Bumbulevičius

    August 26, 2021 at 6:46 pm

    Thanks, Dan! I tried a similar approach and then it resulted in the same way – not updating properly. Thus I tried to, instead, calculate it “elsewhere” in a slider presuming it might become calculated somewhat “earlier” in grand scheme of things. Not working either, though ! But I will keep on digging it, as its an interesting case 🙂

  • Tomas Bumbulevičius

    October 27, 2021 at 6:22 am

    What I eventually ended up using:
    1. Creating EXACT replica of text I want to space out in height. It works as a reference.
    2. Calculating the tracking based on Dan’s expression shared above.
    3. Linking main text’s tracking property to this value.

    It bypasses issue of not updating in viewport. Works on 2021 100%. Thanks again, Dan!

Viewing 1 - 6 of 6 posts

Log in to reply.

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