Forums › Adobe After Effects Expressions › Create shape/box based on word index
Create shape/box based on word index
Christian Simpson
April 2, 2018 at 5:14 pmOne thing I noticed after a while was how changing the font seems to break everything. Do you know why that would be?
Christian Simpson
April 2, 2018 at 5:36 pmOk I figured it out. I needed to change the text for the hidden text layers as well. Everything needs to match up exactly and that makes sense.
Kalleheikki Kannisto
April 2, 2018 at 6:31 pmYes, that’s correct. The typeface, type size, leading and text box width have to match on all layers in order for this to work. And it is still pretty easy to find ways to break this. For instance, you wouldn’t be able to mix typefaces or type sizes, or put line breaks in better places. But if you’re careful, it works.
Kalleheikki Kannisto
Senior Graphic DesignerDorca Musseb
August 22, 2018 at 12:59 amThanks so much for this file.
Not to add to the complexity of it. Any way to highlight a chunk of the text? Not just one word?
Also… this isn’t working with CC2018… 🙁
Kalleheikki Kannisto
August 22, 2018 at 11:11 amWorks fine for me in CC2018. The slider values need to be integers; the expression on the slider should take care of that.
Chunk of text: You can’t span two lines with this code. The only thing you can (possibly) do is to use non-breaking spaces between some words so as to force them to highlight together. But they would have to be on the same line, nevertheless.
What would have to happen to be able to highlight a chunk of text on multiple lines is that you’d have have as many copies of this setup as the maximum number of words you needed to highlight, and a sliders to tell the first and the last word. The number of copies of the highlighting code that would be activate at a given moment would depend on the number of words between the first and the last. The existing setup is complex enough for me, so I wouldn’t want to try that.
Kalleheikki Kannisto
Senior Graphic DesignerJarle Leirpoll
September 12, 2018 at 6:54 amFYI: The expressions engine got an update in the 15.1.0 (CC 2018.1.0) version, where support for extents in Paragraph Text was added. In older versions, only shape layers have extents.
For a Paragraph Text layer, including extents will measure the bounding box, instead of only the bounds of the text’s visible pixels.
This change created problems for some users who had used “sourceRectAtTime(time, true)” for Paragraph Text in older versions, where the extra code didn’t do anything. In newer versions of Premiere Pro, the expressions suddenly behaved very differently, and they had to delete that extra code in their expressions.
Hope this helps.
// Previous expression
text_width = wordLayer.sourceRectAtTime(time, true).width;// How you need to write it now
text_width = wordLayer.sourceRectAtTime(time, false).width;or simply
text_width = wordLayer.sourceRectAtTime().width;
Jarle Leirpoll
PremierePro.netKalleheikki Kannisto
January 23, 2021 at 4:09 pmHere’s the original project file. Will need the above fix in CC2018 on forward.
Kalleheikki Kannisto
January 23, 2021 at 4:19 pmFilip Vandueren
January 23, 2021 at 8:08 pmHere’s my try of a single word highlighter.
This one works as an animation preset that can simply be added to any text-layer (paragraph, point, 3D… doesn’t matter).
Log in to reply.