Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change Layer position by certain value by Marker?

  • David Cabestany

    July 30, 2021 at 4:17 pm

    Try this one, it will repeat whatever keyframed animation you have at the beginning of the layer each time a marker is passed, if you need it to offset the animation rather than just repeating it then someone will have to tweak it a little bit.

    n = 0;

    if (marker.numKeys > 0){

    n = marker.nearestKey(time).index;

    if (marker.key(n).time > time) n–;

    }

    if (n > 0){

    valueAtTime(time-marker.key(n).time);

    }else{

    valueAtTime(0);

    }

  • Robert Røbke

    August 3, 2021 at 7:25 am

    Hey thanks,

    this seems to be nearly the same as in the tutorial? I need the layer to go up in Y position for a certain number of pixels *each* time i create a marker.

    I guess there must be another solution, anybody?

  • Tomas Bumbulevičius

    August 4, 2021 at 8:00 am

    Hey Robert, some info is missing.

    1. Should it go up in time (animated) or just move by 100px instantly?
    2. Does it need to go down?

  • Mischa BKHR

    August 4, 2021 at 1:52 pm

    Hey Robert, just paste this in the position expression:

    P = transform.position; // layer position

    x = marker; // marker

    v = 100; // value that you want to move after each marker

    n = 0;

    if (x.numKeys > 0){

    n = x.nearestKey(time).index;

    if (x.key(n).time > time) n–;

    }

    if (n > 0)

    d = x.key(n).index

    else

    d = 0;

    m = d*v ; //multiplys marker Index times value

    [P[0], P[1]+m]

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