FORUMS: list search recent posts

Resizing Text as you're typing...

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ross Turiano
Resizing Text as you're typing...
on Dec 23, 2012 at 2:04:46 pm

Hello, I'm still pretty new with expressions.
I want the text to fit inside a box or shape layer, without having to resize it every time I type a long phrase. Is there anyway to have the text layer automatically resize, as I'm typing it will get smaller and smaller so it fits inside a set parameter or box.
Basically, the more I type the smaller it will get, so it can fit inside a set box.
I'm not sure if this is possible, but if it is, Thanks!


Return to posts index

Dan Ebberts
Re: Resizing Text as you're typing...
on Dec 23, 2012 at 9:58:11 pm

This Scale expression should do it. The first line is where you set the desired width.


nominalWidth = 150;

for (i = 0; i <= thisComp.width; i++){
temp = sampleImage([i,thisComp.height/2],[0.5,thisComp.height/2]);
if (temp[3] > 0) break;
}
left = i;

for (i = thisComp.width; i >= 0; i--){
temp = sampleImage([i,thisComp.height/2],[0.5,thisComp.height/2]);
if (temp[3] > 0) break;
}
right = i;

w = right-left;
if (w > 0)
value*(nominalWidth/w);
else
value


Dan



Return to posts index

Armand Verhoeven
Re: Resizing Text as you're typing...
on Jan 25, 2013 at 2:13:51 pm

Your expression works Dan except AE have a lot of difficulty after the expression.
Why is that?


Return to posts index


Dan Ebberts
Re: Resizing Text as you're typing...
on Jan 25, 2013 at 7:45:59 pm

That sampleImage() expression is a hack that chews up a lot of processing time. I would use it only as a last resort.

Dan



Return to posts index

Michael Liu
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 9:54:53 pm

Hi Dan,

I'm trying to use the expression you wrote but I can't figure out how to use it.... Do you add the expression to the scale attribute on the shape or the text?

Michael


Return to posts index

Dan Ebberts
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 10:17:05 pm

Yes, that's correct.

Dan



Return to posts index


Michael Liu
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 10:20:14 pm

It doesn't seem to be working when I'm writing the text as it's not auto wrapping the box around the text


Return to posts index

Dan Ebberts
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 11:29:45 pm

All the expression does is scale the text to keep it at a fixed width.

Dan



Return to posts index

Michael Liu
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 11:49:57 pm

I see. Thanks Dan!


Return to posts index


Michael Liu
Re: Resizing Text as you're typing...
on Feb 5, 2014 at 11:25:11 pm

And I may be doing the wrong thing but there doesn't seem to be any relationship between the shape layer and the text.

Michael


Return to posts index

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