Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions start animation before the marker that triggers it

  • start animation before the marker that triggers it

    Posted by Vojtěch Palme on November 26, 2015 at 1:25 pm

    I’m not sure if this is possible.
    I have precomped animation that is played whenever there is a marker in the main composition.


    n = 0;
    if (thisComp.marker.numKeys > 0){
    n = thisComp.marker.nearestKey(time).index;
    if (thisComp.marker.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    0
    }else{
    m = thisComp.marker.key(n);
    t = time - m.time;
    }

    what I need though is for the animation to start and reach certain time by the time it hits the marker. (I use this animation as a transition between 2 compositions I modify every week and being able to place a marker right where the two clips meet, would be more convenient than duplicating the transition animation and moving it in place, carefully aligning the moment this animation covers whole screen with the point two clips are meeting..)
    To make it simple, I attached test project. I need the bubble in it to be yellow right at the point where marker is, just by starting the animation a bit sooner.
    9511_bubbletest.aep.zip

    Vojtěch Palme replied 10 years, 5 months ago 2 Members · 6 Replies
  • 6 Replies
  • Kalleheikki Kannisto

    November 26, 2015 at 4:04 pm

    I didn’t try this, but it sounds like it would work by adding an offset value to the second to last line:

    t = time - m.time + [offset value here];

  • Vojtěch Palme

    November 26, 2015 at 4:36 pm

    that doesn’t do. It clips the beginning of the animation.

  • Kalleheikki Kannisto

    November 26, 2015 at 4:43 pm

    Ok, I see. The nearest marker changes at that point.

    So it needs to find the nearest marker to the point in time plus that offset.

    Does adding the same value to the third line as well work?

    n = thisComp.marker.nearestKey(time+[offset value here]).index;

  • Vojtěch Palme

    November 26, 2015 at 5:17 pm

    That didn’t do anything. Not even error message.
    this is the tutorial I was following when making this

  • Kalleheikki Kannisto

    November 26, 2015 at 6:02 pm

    Looks like it is needed in third location as well, line 4, then should be all set:

    if (thisComp.marker.key(n).time > time + [offset value here]){

    Thus, the whole code would be:

    offset =.5;// your custom offset value here
    n = 0;
    if (thisComp.marker.numKeys > 0){
    n = thisComp.marker.nearestKey(time + offset).index;
    if (thisComp.marker.key(n).time > time + offset){
    n--;
    }
    }
    if (n == 0){
    0
    }else{
    m = thisComp.marker.key(n);
    t = time - m.time + offset;
    }

  • Vojtěch Palme

    November 27, 2015 at 3:42 pm

    Brilliant! Works like a charm. Thank you very much 🙂

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