Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions trigger KF animation from a marker on a different layer + preroll + ignore first marker

  • trigger KF animation from a marker on a different layer + preroll + ignore first marker

    Posted by Roei Tzoref on October 17, 2017 at 9:14 am

    Hi,

    I am trying to trigger a property with keyframe animation of a layer from a marker on a controller layer, the expression works but I need 2 more things:
    1. to have a preroll to the marker time of my choosing. this way the marker will start at the peak of the animation and the start will be prerolled before the marker (let’s say 1 sec before the marker the animation should start).
    2. ignore the first marker. I want to set a comment on the first marker as instructions so I don’t want the 1st marker to trigger the animation

    if possible, I’d like an explanation on what each string does …. like this // so that I won’t come back each time I got a question :/

    this is how a basic setup looks:

    L= thisComp.layer("Controller");
    n = 0;
    if (L.marker.numKeys > 0){
    n = L.marker.nearestKey(time).index;
    if (L.marker.key(n).time > time){
    n--;
    }
    }if (n == 0){
    valueAtTime(t);
    }else{
    t = time - L.marker.key(n).time;
    valueAtTime(t)
    }

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

    Roei Tzoref replied 7 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 17, 2017 at 1:26 pm

    Something like this:


    preroll = 1;
    L= thisComp.layer("Controller");
    n = 0;
    t0 = time + preroll;
    if (L.marker.numKeys > 0){
    n = L.marker.nearestKey(t0).index;
    if (L.marker.key(n).time > t0) n--;
    }
    if (n < 2){
    t = 0;
    }else{
    t = t0 - L.marker.key(n).time;
    }
    valueAtTime(t)

    Dan

  • Roei Tzoref

    October 17, 2017 at 11:05 pm

    Thank you Dan. elegant as usual.

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

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