Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Anchor Point Position

  • Anchor Point Position

    Posted by John Abbott on July 18, 2023 at 3:31 pm

    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).

    John Abbott replied 3 years, 1 month ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy