ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

After Effects: parent to text layer width (source text)

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Guntars Šmits
After Effects: parent to text layer width (source text)
on Mar 25, 2015 at 4:15:25 pm

I have a text layer in which text is displayed though Source Text keyframes
- subtitles (

Want to find a way to add a black box around subtitles, that automatically resizes.

So far I have found a script, that determines the Text Layer size,
but I am not that familiar with javascript writing to apply it to my needs.
(script at the bottom)

There has to be a way to Parent Solid Layers width to Text Layer width.
Haven't found a solution on web.
Anyone up for a challenge?

--> The script:
Through default mask ir determine the size of layer.
Make *.jsx file, select Text Layer and run the script (File/Scripts/RunScriptFile)

app.executeCommand(2367); // 2367 : app.findMenuCommandId("New Mask")
var myTextLayer = app.project.activeItem.selectedLayers[0];
var myMask =;
var myVertices = myMask.maskShape.value.vertices;
var TextWidth = Math.abs(myVertices[0][0] - myVertices[3][0]);
var TextHeight = Math.abs(myVertices[0][1] - myVertices[1][1]);
alert("Size of text in pixels:&#092;t&#092;r&#092;r" +
" width&#092;t = " + TextWidth.toFixed(3) + "&#092;r" +
" height&#092;t = " + TextHeight.toFixed(3));

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved