Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger animation on passing Nth marker in main timeline

  • Trigger animation on passing Nth marker in main timeline

    Posted by Allard Rothengatter on October 29, 2014 at 6:02 pm

    Hey guys,

    I have the following challenge.
    In order the make my animation more flexible I’d like to start an animation in a secondary comp when the main comp passes a specific comp marker. I’ve set a number in the “Chapter” field of the marker so I can check wheter it’s the right animation.

    This works pretty good, but as soon as a new marker is closer to the current time then the one that triggers the animation, it’s being reset the default values.

    What I’d like is to set a “global” variable that will not refresh on each frame as soon as the specific marker is in the past. So that my animation (in this case a linear opacity fade in) stays at 100% in stead of falling back to 0 as soon as time approaches the new marker.

    This way I hope to achieve that by moving a marker on the main timeline, all animations on nested comps will automatically start at the right time.

    I know this all sounds pretty vague, but I sinerely hope some one can help me out with this.

    Thanks!!

    Cheers,
    Allard

    m = comp('SmartBox Overlay').marker
    hasPassed = 0;

    if (m.numKeys > 0) {
    next_frame=m.nearestKey(time);

    if(next_frame.chapter == 1) {
    t = next_frame.time;
    hasPassed = 1;
    if (time > t) {
    ease(time,t,t+0.5,0,100);
    } else {
    0
    }
    } else {
    if(hasPassed == 1) {
    100
    } else {
    0
    }

    }
    } else {
    0
    }

    Allard Rothengatter replied 11 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 29, 2014 at 6:53 pm

    Unfortunately, you can’t do global variables. I’d try it this way:


    m = comp('SmartBox Overlay').marker;
    t = 0;
    for (i = 1; i <= m.numKeys; i++){
    if (m.key(i).chapter == 1){
    t = time - m.key(i).time;
    }else if (m.key(i).time > time){
    break;
    }
    }
    ease(t,0,.5,0,100)

    Dan

  • Allard Rothengatter

    October 29, 2014 at 6:59 pm

    Dan,

    This is exactly what I was looking for.

    Thanks a million for the lightning fast response to my vaguely worded question 😉
    I’ve made some minor adjustments to trigger the animation 2 secs. before the marker.

    But it works like a charm now. No need for me to adjust keyframes in multiple comps anymore.

    Thanks again!!

    Cheers,
    Allard

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