-
How to use “sourceRectAtTime” expression with accents
Hi everyone !
First of all I have to say that I’m french so my English vocabulary is limited and that I’m not really good at scripting so…I’ll try to be as explicit as I can.
Some weeks ago I was looking for a way to create some cool lower thirds in after effects and have them stretch up to fit automatically the text I want.
So I created my text and my background animation. I precomposed this background animation and add a corner pin on it and then used the very useful expression “sourceRectAtTime()” so that the animation fits the size of the text.The idea was to be able to create multiple lower thirds by importing titles using the plugin “CompsFromSpreadsheet” and have my background animations to fit the size of the text in all comps.
This actually works pretty well. But I have one big problem (that makes me regret I wasn’t born in an English speaking country)
As soon as my title contains an accent such as Â,Î, Ô, É, È… the size of the text layer obviously change and my text is no longer centered. The box streches from the bottom to fit the new size.
Here is a screencaps of the problem and the expressions associated with it.
creativecow_sourcerectaccent.jpg
I know I could just add the expression “sourceRectAtTime().height” to the top right corner of the corner pin effect by the other thing is that I’d like to be able to create texts with multiple lines.
I want my background to fit the size of the text even if this one contains accent and be able to add lines if I have to.At work, we thought we could use two text layers, one with accents that defines the size of my background animation, and the other one with or without accents that is displayed. This is a workaround that would work but is there a way to remove accented letters with non accented letters automatically in After Effects ? (by using an expression?)
I’ve been searching for a solution but not any of the workarounds I thought of worked :/
I’d like to hear what you think about that and if you have any solution, I’ll take it !Thanks!
//So far these are the expressions I use on the corner pin effect of my background animation composition //// Top left //
[effect("Quatre coins")("Supérieur gauche")[0],effect("Quatre coins")("Supérieur droit")[1]]
// Top right //
x=thisComp.layer("TITLE é").sourceRectAtTime().width;
[x,effect("Quatre coins")("Supérieur droit")[1]]// Bottom left //
[effect("Quatre coins")("Supérieur gauche")[0],effect("Quatre coins")("Inférieur droit")[1]]
// Bottom right //
y=thisComp.layer("TITLE é").sourceRectAtTime().height;
[effect("Quatre coins")("Supérieur droit")[0],y]
