-
Text that resizes when it hits a margin
Hi,
I’m trying to create an expression that will auto-scale down paragraph text once it gets long enough to hit a margin layer, so that it never goes past that point but text can continue to be typed.
In my project:
I have a shape layer named “Margin”. I have a paragraph text layer named “Text”. I have the following expression applied to the “Text” Scale property:
widthTemp = sourceRectAtTime().width;
rectWidth = (widthTemp*transform. scale[0]) /100;
x = 100
var p1 = thisLayer position-100+rectWidth;
var p2 = thisComp. layer (“Margin”) • position;
var delta = sub (p1, p2) ;
var distance = length (delta) ;
Linear (distance, 0, x, [rectWidth/50, rectWidth/50], [value[0], value [1]]) ;
It does halfway work – when I start typing into the text box, it starts to scale down. But once it goes past the “x” value it starts to scale back up. Is there a way to have it that once it hits x it will continue scaling down to a certain point, and then will carry onto a new line?
Many thanks for any help!