Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Composition markers to trigger in and out of a TR precomp

  • Composition markers to trigger in and out of a TR precomp

    Posted by Roei Tzoref on October 14, 2017 at 11:53 pm

    Hi Expressionists

    I am trying to make composition markers named IN and OUT in my main comp to trigger different precomps TR property. so far the most elegant way I found is through digging in a friend’s solution which is dividing the expression in two.

    here it is:
    say I have in my precomp animation setup that starts from 00:00:00 – 00:02:00 and animation out starts in 00:12:00-00:14:00

    I apply this to the TR property:
    IN= thisComp.marker.key(1).time;
    OUT = thisComp.marker.key(2).time;
    action=thisComp.layer(“marker index”).effect(“Maker index inOut”)(“Slider”);

    if (action==1) { linear(time,IN,IN+2,0,2) };
    if (action==2){linear(time,OUT,OUT+2,12,14) } ;
    if (action>2){[0]}
    if (action==0){[0]}

    and in another layer I add a slider and apply this expression:
    try{
    action=thisComp;
    n = 0;
    if (action.marker.numKeys > 0){
    n = action.marker.nearestKey(time).index;
    if ( action.marker.key(n).time > time){
    n–;
    }
    }

    n
    } catch (err) {
    0
    }

    and it works. but I want something easier, maybe more elegant that I could maybe understand. try-catch is beyond me. maybe this can work with only one layer?

    it’s not bad. I get the first expression, it’s the other one I want to lose or to understand ☺

    the basic setup looks like this so far.

    but it will get more complex, I just wanted to see I figured how to do it. now I can place any animation I want in the precomp. the purpose is to create an easy to control lower third template with a simple rig.

    thanks

    IN= thisComp.marker.key(1).time;
    OUT = thisComp.marker.key(2).time;
    action=thisComp.layer("marker index").effect("Maker index inOut")("Slider");

    if (action==1) { linear(time,IN,IN+2,0,2) };
    if (action==2){linear(time,OUT,OUT+2,12,14) } ;
    if (action>2){[0]}
    if (action==0){[0]}

    ---------------second expression ------------
    try{
    action=thisComp;
    n = 0;
    if (action.marker.numKeys > 0){
    n = action.marker.nearestKey(time).index;
    if ( action.marker.key(n).time > time){
    n--;
    }
    }

    n
    } catch (err) {
    0
    }

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

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

    October 15, 2017 at 12:03 am

    I would think something like this would be all you need:


    IN= thisComp.marker.key(1).time;
    OUT = thisComp.marker.key(2).time;
    if (time < OUT)
    linear(time,IN,IN+2,0,2)
    else
    linear(time,OUT,OUT+2,12,14);

    Dan

  • Roei Tzoref

    October 15, 2017 at 12:45 am

    Yes! and that makes sense to me too!

    Thank you Dan.

    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