FORUMS: list search recent posts

Scripting question: Change text layer size depending on text length

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
C. Blake Davis
Scripting question: Change text layer size depending on text length
on Jan 23, 2018 at 5:04:04 pm

Scripting question:

I need a script that resizes a text layer depending on the length of the text.

I'm already using a script that allows my text to auto update depending on the name of the comp ( compName = comp(" ").name; )
What I need it to be able to change the comp name so it updates the text layer name, but resizes it depending on the length of the text.

I've tried a few versions of the sourceRect but none seem to work.

Any advice?

Producer working in NorCal and Nashville


Return to posts index

Taso Mastorakis
Re: Scripting question: Change text layer size depending on text length
on Jan 23, 2018 at 8:46:36 pm

I'm not sure about updating the layer name but if you need something that resizes text to a size you can try this:

w = (thisComp.width / thisLayer.sourceRectAtTime().width)*90;
h = (thisComp.height / thisLayer.sourceRectAtTime().height)*90;
if(w<100){
[w,w];
}else{
[100,100];
}

Changing the width and height numbers in the first 2 lines will decide the scale of the text within a specific comp size. Hope this helps.


Return to posts index

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