Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible (Character to Anchor Point)

  • Is it possible (Character to Anchor Point)

    Posted by Scott Mcgee on September 22, 2017 at 1:59 pm

    I’ve never thought about it….

    Is there anyway to reference a character to be able to assign the anchor point to that character.

    e.g

    Friday 23rd – 19:45

    I want it to be central (“-“) everytime, but to just centralise it wouldn’t work as there is more characters on the left.

    My thoughts, is to centralise the anchor point, then in position try and find how many characters there is up to (“-“), and subtract it so it offsets itself left to centralise automatically.

    Scott Mcgee replied 8 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 22, 2017 at 5:15 pm

    Interestingly, this kind of works.

    Add this expression to your source text:


    s = value.split("-");
    if (time < 0)
    s[0] + "-"
    else
    value

    and this to the anchor point:

    r = sourceRectAtTime(-1,false);
    x = r.left + r.width;
    [x,value[1]]

    Dan

  • Scott Mcgee

    September 26, 2017 at 10:43 am

    Hey Dan,

    If there’s a more accurate way brill…If not worked enough for me to fiddle with it.

    I want the anchor to sit on “-“, as I have a position expression so it sits directly central on another layer…but just altering the anchorpoint by -33, it sits exactly on the line and works brilliantly.

    I tried manipulating s[0] + “-” but just couldn’t find an easy way other than to -33.

    s = value.split(“-“);
    if (time < 0)
    s[0] + “-”
    else
    value

    r = sourceRectAtTime(-1,false);
    x = r.left + r.width;
    y = r.height/2 + r.top;
    [x-33,y]

    No sweat if not, it works which is the main thing.

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