Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Push Typing Effect to Left at Limit

  • Push Typing Effect to Left at Limit

    Posted by Liam Campbell on April 18, 2018 at 10:43 pm

    Hello,

    I’m looking for a solution to the problem of having a typing effect fill a search box and when it reaches the end to have the last letter always type in the same spot but have it push the whole line over to the left as it does so.

    Thanks,
    Liam

    Liam Campbell replied 8 years, 3 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 18, 2018 at 11:31 pm

    Hard to say without knowing exactly how you have things set up, but something like this should adjust the position of your text to the left as it approaches the right edge of a “Search Box” layer. The margin variable sets how close it can get before the text starts moving to the left:

    L = thisComp.layer(“Search Box”);
    r = L.sourceRectAtTime(time,false);
    margin = 5;
    xMax = L.toComp([r.left + r.width,0])[0] – margin;
    myR = sourceRectAtTime(time,false);
    x = toComp([myR.left + myR.width,0])[0];
    d = [Math.max(x-xMax,0),0];
    value – d

    Dan

  • Liam Campbell

    April 19, 2018 at 2:23 am

    Thank you, the only thing I had to change was the very last line I made it “value + d” or else it would move to the right.

    So is this essentially comparing the width of the bounding box of the search bar to the width of the bounding box of the text minus the margin to determine when the bounding box of the text exceeds that of the search box and therefore should start moving left?

  • Liam Campbell

    April 19, 2018 at 2:10 pm

    If you could explain the code a little bit that would be greatly appreciated. It worked to finish the project but I want to understand to help with situations later on. Thanks again Dan, helpful as always.

    Liam

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