Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions How do I get a loopout to stop after a certain value?

  • How do I get a loopout to stop after a certain value?

  • Harry Masterson

    March 5, 2023 at 3:58 pm

    I have a shape layer that has a trim paths with a loopout expression. I want to animate the shape layer in such a way that once the playhead has passed the second to last keyframe in another layer, the trim paths will continue looping until it reaches 0 again, at which point I want the opacity of the layer to become 0 and stay at 0.

    I cannot figure out how to get the opacity to become 0 only after the second to last keyframe in another layer and after the trim paths has also become 0.

    </p><p>key1 = (thisComp.layer("Control").effect("Slider Control")("Slider").numKeys-1);</p><p><br></p><p>keyTime = thisComp.layer("Control").effect("Slider Control")("Slider").key(key1).time;</p><p><br></p><p>endStroke = thisComp.layer("Rotating Lines").content("Trim Paths 1").end;</p><p><br></p><p>if ((time>=keyTime)&&(endStroke=0)){</p><p><br></p><p> 0;</p><p><br></p><p>}else{</p><p><br></p><p> 100;</p><p>} </p><p><br></p><p>

  • Dan Ebberts

    March 5, 2023 at 4:57 pm

    It will probably be something like this:

    val = 100;
    tolerance = .5
    key1 = (thisComp.layer("Control").effect("Slider Control")("Slider").numKeys-1);
    keyTime = thisComp.layer("Control").effect("Slider Control")("Slider").key(key1).time;
    endStroke = thisComp.layer("Rotating Lines").content("Trim Paths 1").end;
    if (time >= keyTime){
    t = time;
    while (t >= keyTime){
    if (endStroke.valueAtTime(t) < tolerance){
    val = 0;
    break;
    }
    t -= thisComp.frameDuration;
    }
    }
    val

    I put a tolerance value in there in case it doesn’t quite get to zero exactly on a frame boundary. You might not need it, but it probably doesn’t hurt anything.

Viewing 1 - 2 of 2 posts

Log in to reply.

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