FORUMS: list search recent posts

Composition size based on text bounding box

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pedro Amaral
Composition size based on text bounding box
on Mar 23, 2015 at 2:20:57 pm

Hey,

This may sound a bit ambitious but I was wondering if there is a way to have a composition to resize its width and height based on a text layer bounding box?

I have a precomposed text layer and its comp size is matching the text bounding area, the problem is, if I increase the font size, increase the number of lines of text, align the text differently, etc, it will get cropped off in the comp.

I'm looking for a way to link the comp size to the bounding box of the text layer, just so if create another paragraph of text or delete one, the whole comp size could adjust itself?

I'm aware of scripts such as Auto Crop (http://aescripts.com/auto-crop/) which can do somehow what I'm looking for but considering this .ae file is for client delivery and the text content will be changing
randomly, the best solution would be an expression that could do it on the go.

Any ideas?

Thanks in advance!


Return to posts index

Dan Ebberts
Re: Composition size based on text bounding box
on Mar 23, 2015 at 4:32:03 pm

Expressions can't change the dimensions of a comp, so you need a different approach. Why are you pre-comping the text?

Dan



Return to posts index

Pedro Amaral
Re: Composition size based on text bounding box
on Mar 23, 2015 at 5:22:43 pm

Hi Dan,

Thank you for reaching out.

I assumed this would not be that easy to achieve.

I'm providing a native .ae file to a client and wanted to have it precomped as they will find it easier to edit and re-type whatever they need in a clean comp without messing with other animated layers on the main comp.

I'm using a Linear Wipe effect (with CC Composite with 50% opacity and then a second Linear Wipe that will reveal the text in its full opacity) on the same text layer but, text layers are continuously rasterized locked and because of that the Linear Wipe effect is getting its margins from the comp dimensions - meaning the percentage of the wipe won't be accurate to affect the text from 0% to 100% and the client will have to adjust easing himself depending on the amount of text.

I kind of made it work using CC Jaws which actually wipes the text from its bounding box margin but I'm having a hard time to get the 50% opacity from CC Composite to work, for some reason it is not working on text layers but it works on normal solids, which makes me think the continuously rasterized box is messing the whole thing again...

I would like to avoid track mattes as there are a couple mixed up already, and again I have no control on the amount of text, lines, etc, the client will need to use.

Sorry if I'm sounding too confusing on my description..


Return to posts index


Dan Ebberts
Re: Composition size based on text bounding box
on Mar 23, 2015 at 6:04:38 pm

You might consider putting all editable text in one master text comp and link to that via source text expressions (and maybe scale), and then within the comp that will actually render, use the text's actual dimensions (using sourceRectAtTime) to drive the Linear Wipe.

Another option might be a dockable script panel where they just enter text there, and an Update button causes the script to change the project to match the text.

Dan



Return to posts index

Pedro Amaral
Re: Composition size based on text bounding box
on Mar 24, 2015 at 3:26:28 pm

Hey Dan,

thanks again for your time and reply.

Indeed the best solution would be a script panel just for typing out, unfortunately I have no scripting knowledge and little time for delivery.

We kind of worked it out by limiting the amount of lines per block of text, meaning we have the precomp with the same size all along and the Linear Wipe doesn't look so bad.

Cheers


Return to posts index

Pedro Amaral
Re: Composition size based on text bounding box
on Mar 24, 2015 at 6:32:11 pm

Actually, is there an expression to have an adjustment layer size to always match a text layer's bounding box size?

As I have the text precomposed I can use an Adjustment Layer with my effects setup (LinearWipe 01, CC Composite, LinearWipe 02) to do the magic.

Just need to know how to link the dimensions of my Adjustment Layer to the Text Layer dimensions.

Thanks!


Return to posts index


Dan Ebberts
Re: Composition size based on text bounding box
on Mar 24, 2015 at 6:55:45 pm

Assuming you have a recent version of AE, this should work:

L = thisComp.layer("text");
r = L.sourceRectAtTime(time,true);
w = r.width*L.scale[0];
h = r.height*L.scale[1];
[w/width,h/height]


Dan



Return to posts index

Pedro Amaral
Re: Composition size based on text bounding box
on Mar 30, 2015 at 11:44:55 am

Hey Dan,

Thank you so much for the expression
I'm still on CS6 unfortunately I can't get the sourceRectAtTime line to work:

L = thisComp.layer("text");
r = L.sourceRectAtTime(time,true);
w = r.width*L.scale[0];
h = r.height*L.scale[1];
[w/width,h/height]

Is there an alternative workable on CS6 for that?


Return to posts index

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