Copy link to clipboard
Copied
I’m trying to create a MOGRT with some unique functionality I haven’t seen anywhere else online. Our clients use two weights of font on their Video Captions (which currently they type manually) in order to highlight specific words within the text. So for example, they might like to style:
“The Quick Brown Fox, jumps over the lazy dogs”
as
“The Quick Brown Fox, jumps over the Lazy Dogs“
The solution i’m currently using is a bit of a workaround, based on Jarle Leirpoll’s example in making Mogrts ebook.
string = thisComp.layer("Highlighted Words").text.sourceText.split("+");
result = 0;
for (i = 0; i < string.length; i++){
if (textIndex == parseInt(string[i],10)){
result = 100;
break;
}
}
result
Using this running through an expression selector in the Amount Setting, I can successfully tie this to a stroke width animator to give the characters a bit of extra thickness based on a simple code in a separate hidden text layer i.e
1+3+4+5+9+10 Applies the effect to the corresponding word. Its quite intuitive for the client to understand.
However this is a bit of a workaround and the font used with the 3.0 stroke weight doesn’t exactly match the other weight of font i’m trying to replicate. Is there a way to combine this method with something like style.setFont so that the highlighted words utilise the correct font weight?
Hopefully that all makes sense!
Any help would be greatly appreciated!
To my knowledge you still can't bold parts of a sentance using expressions in AE you'll just get "The Quick Brown Fox, jumps over the [Object, object]."
The closest thing you can do is hook up multple text layers that move automatically depending on the length of the previous text. You can do that using the position and sourceRectAtTime().width in the expressions.
If you want to get clever with it you could have it so one text layer thats hidden controlls the rest of the layers by using .split so
...Copy link to clipboard
Copied
To my knowledge you still can't bold parts of a sentance using expressions in AE you'll just get "The Quick Brown Fox, jumps over the [Object, object]."
The closest thing you can do is hook up multple text layers that move automatically depending on the length of the previous text. You can do that using the position and sourceRectAtTime().width in the expressions.
If you want to get clever with it you could have it so one text layer thats hidden controlls the rest of the layers by using .split so if you write something like:
“The *Quick Brown Fox*, jumps over the *Lazy Dogs*”
you will get
“The Quick Brown Fox, jumps over the Lazy Dogs“
Copy link to clipboard
Copied
Can't edit my post for some reason. Made this test file.
Needs a bit of work but the general idea is there.
Copy link to clipboard
Copied
This is amazing, thank you. I think i can adapt this to work for my needs!
Copy link to clipboard
Copied
Just posted the same question, before I found this.
Any possibility of getting the test file as well, so I can adapt it to what I need?
Thanks!!
Copy link to clipboard
Copied
Sure, this is a slightly updated version. It only works with left aligned text, but you can amend the position expression to fix that.
If you want to change the text size and leading you do it on the master text layer, I found the auto leading doesn't always work for some reason.
Copy link to clipboard
Copied
Awesome, thanks!
Checking it now. Will post back if/when I've found a solution!
Copy link to clipboard
Copied
OK, that totally did what it was supposed to do!
There was a slight error with the 3rd part of the line not attaching correctly to the bold part, but adding the sourceRectAtTime().left data fixed it :
previousText = thisComp.layer(index-1); x = previousText.position + previousText.sourceRectAtTime().width + previousText.sourceRectAtTime().left;
Perfect !! THANKS SO MUCH!!
This now opens up lots of new possibilities!
Copy link to clipboard
Copied
is there a way to post the full code? interested in doing the same thing but the wetransfer links expired and can't figure out how to do this either
Copy link to clipboard
Copied
VFX Bear, do you still happen to have the full code for this? The links expired, and I'd love to know more about how this was resolved. Would like to know if this expression is on the scale parameter, as this is where I'm finding most of the expressions need to go in order to align them to previous layers.
Thanks for any and all help!
Copy link to clipboard
Copied
Hello! Link is expired, possible to upload a new one? Thank you!
Copy link to clipboard
Copied
Hi, the link is expired. Could you please share it again?
Thank you 😄
Copy link to clipboard
Copied
Hi Gregory, firstly, thank you for figuring this out. Secondly, any chance you still have this file lying around somewhere as the WeTransfer link has expired 😞 Thank you in Advance.