Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Follow the Leader Expression–Only on one axis

  • Follow the Leader Expression–Only on one axis

    Posted by Thomas Downs on September 18, 2006 at 4:03 pm

    This well-known expression makes a layer ‘follow the leader.’ It works on both X and Y. How do I restrict it to only the X dimension?

    delay = 5; //number of frames to delay

    d = delay*thisComp.frameDuration*(index – 1);
    thisComp.layer(1).position.valueAtTime(time – d)

    Cheers!

    Dave O’dowd replied 19 years, 6 months ago 5 Members · 5 Replies
  • 5 Replies
  • Mylenium

    September 18, 2006 at 4:35 pm

    You simply extract it by accessing the array it is stored in 😉

    thisComp.layer(1).position.valueAtTime(time – d)[0]

    Mylenium

    [Pour Myl

  • Richard Powell

    September 18, 2006 at 5:20 pm

    Hey Mylenium, that was me (govinda) using an old account out of desperation.

    That line of code gives me an error when I replace my second line with it. ‘Expression result must be of dimension 2, not 1. Error occurred at line 0.’

    Is there more to this?

  • Dan Ebberts

    September 18, 2006 at 5:26 pm

    This should do it:

    d = delay*thisComp.frameDuration*(index – 1);
    p = thisComp.layer(1).position.valueAtTime(time – d);
    [p[0],value[1]]

    Dan

  • Mylenium

    September 18, 2006 at 6:47 pm

    Yeah, sorry for being so ominous. Dan has already provided the full code, so go, get it. ;O)

    Mylenium

    [Pour Myl

  • Dave O’dowd

    November 9, 2006 at 4:59 pm

    Hey all,
    I’m trying to use this expression to create a herd of caribou following a leader along the x-axis of my comp, but when I apply the expression I get the error “no property or method named delay”, any suggestions?

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