Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions x amount of position move on layer marker

  • x amount of position move on layer marker

    Posted by Naoko Hara on April 25, 2018 at 4:23 pm

    I have a null layer with an X position move and another master null with a some boxes attached.
    Trying to have this master null move X positions (1734px to be exact) every time theres a layer marker on the master null.

    I tried using below expression but even if I add more “if”s, I only got it to move twice.

    Help?

    position;
    if (marker.numKeys > 0 && time >= marker.key(1).time){
    thisComp.layer("Ctrl_Pos").transform.position.valueAtTime(time-(marker.key(1).time))+position;
    }

    Dan Ebberts replied 8 years ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 25, 2018 at 5:04 pm

    Try this:


    m = marker;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    }
    value + [n*1734,0]

    Dan

  • Naoko Hara

    April 25, 2018 at 8:32 pm

    What if don’t want it to jump but have it slide over?

  • Dan Ebberts

    April 25, 2018 at 10:08 pm

    More like this, I guess:


    m = marker;
    moveTime = .5;
    moveAmt = 1734;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    }
    if (n > 0){
    t = time - m.key(n).time;
    x = (n-1)*moveAmt + linear(t,0,moveTime,0,moveAmt);
    value + [x,0]
    }else
    value

    Dan

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