Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions follow the leader maintain original position

  • follow the leader maintain original position

    Posted by Riccardo Sinti on October 30, 2014 at 3:51 pm

    I have a column of square layers like this :

    .
    .
    .
    .
    .
    .

    I want the bottom one to fall away and then have the rest follow with a delay so I use this expression on the layers above the bottom layer:
    delay = thisComp.layer(“USA”).effect(“delay”)(“Slider”); //number of frames to delay

    d = 5;
    thisComp.layer(index + 1).transform.position.valueAtTime(time – d)

    of course this puts all the layers at the start position of the bottom layer.
    How would I tell the expression to maintain current position or build in a yOffset that would compensate?

    Thanks

    Riccardo Sinti replied 11 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Xavier Gomez

    October 30, 2014 at 5:47 pm

    This might answer your question, but it assumes you named the keyframed leader “LEADER”.
    You can change that.

    Xavier

    lead = thisComp.layer("LEADER");
    refTime = 0; // a time where all layers are lined up
    if (time<= refTime) {value;}
    else{
    delay = Math.abs(lead.index-index)*framesToTime(thisComp.layer("USA").effect("delay")("Slider").value, 1/thisComp.frameDuration);
    lead.transform.position.valueAtTime(time-delay) + valueAtTime(refTime) - lead.transform.position.valueAtTime(refTime);
    };

  • Riccardo Sinti

    October 30, 2014 at 6:18 pm

    Thank You Very Much!
    That worked great.

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