Activity › Forums › Adobe After Effects Expressions › Changing Shape Layers size (width) due to text width
-
Changing Shape Layers size (width) due to text width
Ter Ber replied 5 years, 9 months ago 14 Members · 23 Replies
-
Filip Vandueren
July 23, 2020 at 9:48 amBTW,
instead of making the box with rectangle and two expressions, it is better to do it with a Path-shape:
expression for Path of a shapeLayer:
t=thisComp.layer("my_text");
sr = t.sourceRectAtTime();marginH = t.text.sourceText.style.fontSize * 0.5;
marginV = marginH * 0.75;tl = fromCompToSurface(t.toComp([sr.left - marginH, sr.top - marginV]));
tr = fromCompToSurface(t.toComp([sr.left + sr.width + marginH, sr.top - marginV]));
br = fromCompToSurface(t.toComp([sr.left + sr.width + marginH, sr.top + sr.height + marginV]));
bl = fromCompToSurface(t.toComp([sr.left - marginH, sr.top + sr.height + marginV]));createPath( [tl,tr,br,bl], [], [], true);
Add Fill, Stroke, rounded corners to taste.The upside of this method is that the Path text-box can rotate with the Text. Even if the Text is rotating in 3D.
-
Ter Ber
July 23, 2020 at 1:08 pmPerfect….absolutely perfect!
Asking for help and being blessed with someone else, whom you’ve never met and from any part of the world to collaborate and showing kindness is the most satisfying thing.Thank you SO much Filip (and everyone else here) for your contributions.
🙂
Reply to this Discussion! Login or Sign Up