Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Triggering animation with layer marks

  • Triggering animation with layer marks

    Posted by Marcelo Cabral on October 21, 2017 at 1:03 pm

    Hi, I´m using this expression to trigger the last keyframe of three simple keyframes. How to modify the expression to trigger the entire animation using two layer marks?. I mean, the first mark will trigger the keyframe 1 and the second mark will control when the animation finishes. Thank you!

    L = thisComp.layer("Control");
    if ((L.marker.numKeys > 0) && (numKeys > 2) && (time > key(2).time)){
    t2 = key(2).time;
    t3 = key(3).time;
    tm = L.marker.key(1).time;
    t = linear(time,t2,tm,t2,t3);
    valueAtTime(t);
    }else
    value

    Marcelo Cabral replied 8 years, 6 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    October 21, 2017 at 2:50 pm

    Is the time from keyframe 1 to keyframe 2 fixed, or does the whole animation stretch/compress?

    Dan

  • Marcelo Cabral

    October 21, 2017 at 10:42 pm

    Hi Dan
    What I need is the whole animation. The current expression is stretching the time between keyframe 2 and 3.

  • Dan Ebberts

    October 21, 2017 at 11:08 pm

    I think this is what you’re asking for, but I’m not sure:


    L = thisComp.layer("Control");
    if ((L.marker.numKeys > 0) && (numKeys > 2) && (time > key(1).time)){
    t1 = key(1).time;
    t2 = key(3).time;
    tm = L.marker.key(1).time;
    t = linear(time,t1,tm,t1,t2);
    valueAtTime(t);
    }else
    value

    Dan

  • Dan Ebberts

    October 22, 2017 at 12:01 am

    That wasn’t right. Maybe this is closer:


    L = thisComp.layer("Control");
    if ((L.marker.numKeys > 1) && (numKeys > 1)){
    t1 = key(1).time;
    t2 = key(numKeys).time;
    tm1 = L.marker.key(1).time;
    tm2 = L.marker.key(2).time;
    t = linear(time,tm1,tm2,t1,t2);
    valueAtTime(t);
    }else
    value

    Dan

  • Marcelo Cabral

    October 22, 2017 at 3:04 am

    Thank you, Dan! I will give it a try. Sure is fine 🙂

  • Marcelo Cabral

    October 26, 2017 at 11:45 am

    Hi Dan
    The expression works perfectly! Thank you. 🙂

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