Amazing preset. I was told again and again it was impossible to get the size of individual lines in a text box since sourceRectAtTime uses the boundary of the entire text box.
I am having problems utilizing the full potential though since I cant figure out what the Left – Top value is relative to.
I am trying to create a coloured box for just one of the lines in a text box that automatically resizes when I change the text. Therefore I changed the sourceSubRect Helper to be based on Lines instead of characters.
And I have added a shape layer with a path (and a fill) and added this code from the mask path that the preset generates to the path.
pos=thisComp.layer("Text").effect("Left - Top")("Point"); //I have pickwhipped the effect to the text-layer.
dim=thisComp.layer("Text").effect("Width - Height")("Point");
pts=[
pos,
pos+[dim[0],0],
pos+dim,
pos+[0,dim[1]]
];
createPath(pts,[],[],true);
It creates a perfect sized box for my line, but I cant really figure out how to position it.
When I have marked the Text layer I can see that the mask created is positioned correct, but if I try to use the points from “Left – Top” in the position of the TextBox/Shape Layer it is placed outside of the comps boundaries.
My text layer is positioned at x = 0 and y = 0 and the anchor point on both my Text layer and Shape layer is placed top left with this expression
sourceSize = thisLayer.sourceRectAtTime(time, false);
T = sourceSize.top;
L = sourceSize.left;
[L , T]
The left value always ends up around -515 and -519 (depending on the text) but I have no idea how to use these values.