ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Push Typing Effect to Left at Limit

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Liam Campbell
Push Typing Effect to Left at Limit
on Apr 18, 2018 at 10:43:15 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


Return to posts index

Dan Ebberts
Re: Push Typing Effect to Left at Limit
on Apr 18, 2018 at 11:31:33 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



Return to posts index

Liam Campbell
Re: Push Typing Effect to Left at Limit
on Apr 19, 2018 at 2:23:01 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?


Return to posts index


Liam Campbell
Re: Push Typing Effect to Left at Limit
on Apr 19, 2018 at 2:10:29 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]