-
Anchor Point Position
I have put the following expression to anchor point property of the text layer.
const sourceRect = thisLayer.sourceRectAtTime(0, false);
let { width, height, top, left } = sourceRect;
const { fontSize, leading, autoLeading } = thisLayer.text.sourceText.style;
const lineGap = autoLeading ? fontSize * 1.2 : leading;
const textSize = fontSize / 2;
const numLines = Math.max(
text.sourceText.value.split(/[^\r\n\3]*/gm).length – 1,
0
);
height = lineGap * (numLines – 1) + textSize;
topLeft = [left, -textSize];
thisLayer.add(topLeft, [0, height]);
I have found it from https://motiondeveloper.com/blog/dealing-with-descenders to position the anchor point to the bottom left corner, ignoring descenders. But it is not working, placing anchor point at some distance from expected position(check screenshot attached).
Sorry, there were no replies found.