Copy link to clipboard
Copied
Hi,
Im fairly new to After Effects but i somehwhat know my way around it and have used expressions before to create dropdown menus in mogrts etc.
I'm creating a mogrt for an editor and i have a lower third animating in, it is controlled by 'position' keyframes. However, the length of the lower third will be adjusted depending on the amount of text in the box. So ideally, i would need the 2nd keyframe to be editable in length (it also needs to be capped at a specific max length so it doesnt affect the safe zone of the comp). I need this 2nd keyframe to hold for a duration of roughly 6 seconds until it animates out.
I think this can be done using the slider control and perhaps a null layer?
I would appreciate if someone could help and provide clear instructions as im fairly new to mogrts and expressions.
My layers below:
thanks!
Copy link to clipboard
Copied
Try the forum for After Effects.
Copy link to clipboard
Copied
Thanks!
posted it here if anyone can help:
Copy link to clipboard
Copied
The solution is to use sourceRecAtTime().width, and if you want to compensate for paragraph justification, add in sourceRectAtTime().left plus some padding to determine the last position of the layer.
The position keyframes in your screenshot are set on a nested composition, so you'll have to dig into that nested comp's text layer to determine the width. The expression would be something like this:
ref = comp("RECTANGLE LOWER THIRD").layer("Main Text");
b = ref.sourceRectAtTime();
pad = 100; // 100 pixel left padding, could be a slider
sp = -b.width;
ep = b.left + pad;
t= time - inPoint;
m = 30 * thisComp.frameDuration; // could be a slider to set the timing
x = easeOut(t, 0, m, sp, ep);
[x, value[1]]
This would eliminate the need for keyframes. You could set the timing in frames by a slider and the padding by another slider. You would get something like this: