Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Markers trigger opacity groups (easy one!)

  • Markers trigger opacity groups (easy one!)

    Posted by Jeff Bobbington on March 11, 2014 at 2:05 pm

    Hi guys,

    This is an easy one I think, just need some help getting it together!
    I have a bunch of layers, each of which has a slider called ‘Group Number’.
    Some are set to 1, some are 2, 3 and so on, each represents the group that the layer is part of.

    From the first marker (& onwards)on comp timeline, I would like ONLY group 1 to be 100% Opacity, when the 2nd marker is passed, ONLY group 2 should be 100% opacity, and so on.

    Anyone have a short opacity expression that does this?

    Jeff Bobbington replied 12 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 11, 2014 at 5:46 pm

    Assuming your markers are comp markers, this should work:


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

    myGroupNumber = Math.round(effect("Group Number")("Slider"));
    if (myGroupNumber == n) 100 else 0

    Dan

  • Jeff Bobbington

    March 12, 2014 at 10:10 am

    Perfect sir, thankyou.

    Whilst on topic, I wanted to add a 10 frame solid(its actually a TV interference video)over the top to hide those switching layers underneath.
    So, relative to each comp marker, at -5f the layer opacity becomes 100%, then after +5f it goes back to 0%. No fades necessary.

    Is there an expression to trigger this at every comp marker?

  • Dan Ebberts

    March 12, 2014 at 5:43 pm

    Something like this should work:


    m=thisComp.marker;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    }
    if (n > 0){
    t = time - m.key(n).time;
    if (Math.abs(t) <= 5*thisComp.frameDuration) 100 else 0
    }else
    value

    Dan

  • Jeff Bobbington

    March 13, 2014 at 11:29 am

    Awesome, that’s actually more complex than I had anticipated.
    Thanks Dan

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