Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime& Text Tracking

  • sourceRectAtTime& Text Tracking

    Posted by Claire Selim on June 23, 2020 at 1:11 pm

    Hi all,

    Thanks so much in advance for your time / any thoughts you can offer.

    I’m looking to set up an easy to use template in After Effects and am trying to connect the values from a Tracking Animator applied to a text layer with the sourceRectAtTime() value from that text.

    Essentially, I’m hoping to create a piece of text that always stays the same width (via tracking between the letters) across the screen, regardless of what that text is (without the tracking going below 0). A simple 4 letter word would fill the same width of the screen as a full sentence – the only difference being the tracking between the letters…

    I’ve managed to link the two using duplicate layers and a slider control etc, but it isn’t really fit for purpose. I can’t get it to fix to a width – the best I can manage is a simple inverse relationship clamped to positive values.

    Any help you can offer would be very much appreciated!
    Thanks so much,
    Claire

    Claire Selim replied 6 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Andrei Popa

    June 24, 2020 at 9:20 am

    You can try this.
    I used linear for the value because if I directly inserted the value, tracking would be set correctly but the text would not change.
    Basically, what I did is measure the text at -1 time(outside comp, before tracking), and set tracking to change from 0 to the calculated value in the frame before zero.
    For calculating the value, I divided the difference between actual size and desired size by the number of letters-1. Also, if the text is larger, the tracking stays at zero. If you want to change this, change last line to linear(time, 0 – thisComp.frameDuration, 0, 0, diff / numLetters)


    actualWidth = sourceRectAtTime(-1, false).width;
    desiredWidh = 250;
    diff = desiredWidh - actualWidth;
    numLetters = text.sourceText.value.split("").length;
    diff > 0 ? linear(time, 0 - thisComp.frameDuration, 0, 0, diff / numLetters) : 0;

    Andrei
    My Envato portfolio.

  • Andrei Popa

    June 24, 2020 at 9:23 am

    Forgot to subtract the 1 from the letter number.


    actualWidth = sourceRectAtTime(-1, false).width;
    desiredWidh = 250;
    diff = desiredWidh - actualWidth;
    numLetters = text.sourceText.value.split("").length-1;
    diff > 0 ? linear(time, 0 - thisComp.frameDuration, 0, 0, diff / numLetters) : 0;

    Andrei
    My Envato portfolio.

  • Claire Selim

    June 24, 2020 at 11:33 am

    Oh my goodness, that is brilliant!

    Thank you so much for your help, that works perfectly!!

    I wasn’t even sure it could be done! Thank you so much Andrei, I really appreciate your help! Really kind of you.

    Many thanks again,
    Claire

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