-
Automatically wrap variable text with a color boundary box
Hi Creative Cow,
I’m attempting to add some customised subtitles to a video. I’m using the following expression to link Metadata Speech function produced in Premiere 5.5, and then imported into After Effects.
What I’d like to do is wrap this text in a 80% grey transparent box that varies in x according to the number of words on screen at any one time. The text color I can easily change, but I can’t figure out how to highlight the text in a box. Thanks in advance.
James
L = thisComp.layer("name of your video. extension");
max = 5; // number of words to display
n = 0
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time){
n--;
}
}
s = " ";
if (n > 0){
base = Math.floor((n-1)/max)*max + 1;
for (i = base; i < base + max; i++){
if (i <= L.marker.numKeys){
s += L.marker.key(i).comment + " ";
}
}
}
s