Copy link to clipboard
Copied
Hey guys,
i am pretty new to expressions (Just know some basics) and i ran into a problem.
I am creating a template right now and the user should be able to enter two titles: One main title and a subtitle.
I want the subtitle to have the same width as the main title.
Is there any way to get this done automatically?
So for example the user writes into the first title: The Doggo Loves Walkies, and into the second title: The True Story Of The Doggo.
The second title should then scale up or down, depending on the width of the first title so that they line up on both sides.
Sorry for the bad explanation...I hope you understand what I mean...
Let me know if my idea is stupid and there is a much easier way to get this done.
Thank you already!
Copy link to clipboard
Copied
You could try a scale expression like this:
w1 = thisComp.layer("First Title").sourceRectAtTime(time,false).width;
w2 = sourceRectAtTime(time,false).width;
s = (w1/w2)*100;
[s,value[1]]
Dan
Copy link to clipboard
Copied
Hey Dan,
that works perfect! Exactly what I was looking for! Thank you man.
Copy link to clipboard
Copied
Hi Dan, i have seen a lot of questions here that were solved by you, so congrats and thank you for all your support! Here is my question.... I tried that expression but it only resized the width, can you tell me how can i have the height resized too? I am searching for this anwser for many hours... i dont know nothign about coding so i´m sorry if it wasnt a clever question.....
Thanks!
Copy link to clipboard
Copied
This should work
w1 = thisComp.layer("First Title").sourceRectAtTime(time,false).width;
w2 = sourceRectAtTime(time,false).width;
s = (w1/w2)*100;
[s,s]
Copy link to clipboard
Copied
你可以试试这个表达式transform.ypositon+index*数值