Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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

  • Change Layer position by certain value by Marker?

  • Robert Røbke

    July 30, 2021 at 2:22 pm

    Hi,

    is there any expression to change a layer or precomps position with markers? I found something like this:

    https://www.youtube.com/watch?v=b9AVrj8UFvs

    https://www.youtube.com/watch?v=B_3XS2-VWOM

    But it’s not exactly what i am dreaming of and i am not able to change it like i want. ? I want a layer / comp to go up (y position) e.g. for 100px each time if i set a new marker.

    Hope you can follow along ? Looking forward to your answer. Thanks alot in advance! ❤

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • 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]

Viewing 1 - 5 of 5 posts

Log in to reply.

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