Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Same expression works in one comp but not in the others

  • Same expression works in one comp but not in the others

    Posted by David Cabestany on October 25, 2022 at 4:36 pm

    I have a main comp (“footage strip”) with 4 nested comps named set1, set2, set3, and set4; each has a marker at different times.

    Inside each “Set” comp there is a few layers, one of which needs to fade in when the markers in the outer comp layers are passed, for that I added this expression to the opacity:

    c=comp(“footage strip”);

    l= c.layer(thisComp.name);

    s=l.marker.key(1).time;

    d=comp(“footage strip”).layer(“xp”).effect(“fd”)(“Slider”);

    ease(time,s,(s+d),0,100);

    The problem is that it works as expected on Set1 but it does nothing on the remaining three, there is no error warning, it just stays at 0 after the markers are passed on each layer in the top comp.

    I tried replacing thisComp.name with the index for each layer (which defeats the purpose of the expression anyway) and didn’t work either.

    Thanks in advance for your help.

    David Cabestany replied 3 years, 11 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    October 25, 2022 at 5:43 pm

    Just a hunch that the ones that don’t work also don’t start at time=0 in the “footage strip” comp.

    If that’s the case, try this:

    c=comp("footage strip");
    l= c.layer(thisComp.name);
    s=l.marker.key(1).time;
    d=comp("footage strip").layer("xp").effect("fd")("Slider");
    s -= l.startTime;
    ease(time,s,(s+d),0,100);
  • David Cabestany

    October 25, 2022 at 5:50 pm

    This works great, as always thanks a lot!

  • David Cabestany

    October 26, 2022 at 3:04 pm

    Hey Da, any chance you can explain this line a little more in detail?

    s -= l.startTime;

    looks like part of a conditional statement but is not quite, I’m not clear on what is doing or how

  • Dan Ebberts

    October 26, 2022 at 4:03 pm

    It just subtracts the layer’s start time from the marker time, to compensate for the layer not starting at time = 0.

  • David Cabestany

    October 26, 2022 at 10:14 pm

    but why the = sign? wouldn’t it work just by typing s-l.startTime?

  • Dan Ebberts

    October 26, 2022 at 11:15 pm
    s -= l.startTime;

    is equivalent to this:

    s = s - l.startTime;
  • David Cabestany

    October 26, 2022 at 11:28 pm

    I learned something new today. Thanks!

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