Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions loopOut on keyframes AND modifying them with the linear() expression

  • loopOut on keyframes AND modifying them with the linear() expression

    Posted by Patrick Grossien on June 12, 2024 at 4:04 pm

    Sorry to bringing this one up again, as there have been similar problems all over. I just can’t figure out a solution for my specific problem.

    The problem is how to add a loopOut expression to a set of keyframes while having a linear expression modifying one of the keyframes.

    So.

    I have this keyframed setup for a shape line trim with all three properties set to loopOut().

    Start 50 > 75 > 50

    End 50 > 25 > 50

    Offset -180 > 180

    I have to create about 200 trim line animations and since the repeater doesn’t allow for time offsets, I am doing it via layers and keyframes – now I want to easily modify or randomize the line length by changing the middle keyframe values via the linear expression and still be able to place a loop on these keyframes.

    In the attached screenshot I linked the middle key to a slider for easier experimentation (the first keyframes are just to create a break) The loopOut should be added to the following expression (or if you have an overall better idea, let me know).

    first = key(2).value;
    second = key(3).value;
    newValue = effect("Length 25-80")("Slider");
    linear(value, first, second, first, newValue);

    (Would be all so easy if we were able to offset and randomize a shape repeater by time 😉

    Thanx a ton for your thoughts!

    Patrick Grossien replied 1 year, 10 months ago 4 Members · 16 Replies
  • 16 Replies
  • Hector Vera

    June 12, 2024 at 4:29 pm

    Heya! I found this information to your question and hopefully this will help you in some ways:

    You can add the loopOut expression to the middle keyframe by using the pick whip tool to select the keyframe and the expression editor. Here’s an example:

    1. Select the layer with the keyframes and open the expression editor (Shift + F9).
    2. In the expression editor, select the keyframe you want to modify (in this case, the middle keyframe).
    3. Click the pick whip tool (the squiggly line icon) and select the “LoopOut” parameter from the Effects Controls panel.
    4. This should now show the LoopOut expression in the editor window. If you want to change the loop to a different number of times, you can adjust the expression as needed.
    5. Save the changes to the expression and close the expression editor. The LoopOut expression should now be applied to the middle keyframe.

    I hope this helps! Let me know if you have any further questions about this!

  • Dan Ebberts

    June 12, 2024 at 5:03 pm

    Not sure this is exactly what you’re looking for, but you could try this instead of loopOut():

    t = time%key(numKeys).time;
    first = key(2).value;
    second = key(3).value;
    newValue = effect("Length 25-80")("Slider");
    linear(valueAtTime(t), first, second, first, newValue);
  • Patrick Grossien

    June 16, 2024 at 4:13 pm

    Hey Hector, thank you very much for your response. Sadly I wasn’t able to follow the steps you described.

    2 In the expression editor, select the keyframe you want to modify (in this case, the middle keyframe).

    > How would I be able to select a keyframe “in” the editor? The editor is just for text entry afaik.

    3 Click the pick whip tool (the squiggly line icon) and select the “LoopOut” parameter from the Effects Controls panel.

    > How am I able to set a “Loop Out” in the Effects Controls Panel? Is there a “Loop” Effect I am missing?

    5 Save the changes to the expression and close the expression editor. The LoopOut expression should now be applied to the middle keyframe.

    <font face=”inherit”>> Saving changes in the editor itself? </font>

    <font face=”inherit”>Somehow </font><font face=”inherit” style=”font-family: inherit; font-size: inherit;”>I have the feeling we are talking about </font>different<font face=”inherit” style=”font-family: inherit; font-size: inherit;”> things here?! What am I missing. </font>Would love to know!

  • Patrick Grossien

    June 16, 2024 at 4:14 pm

    As always – “Dan, the man”! Thank you very much! This works as intended for me. I somehow have to be able to wrap my head around how to use modulo to its full extent.

  • Patrick Grossien

    June 16, 2024 at 4:17 pm

    Now if I manage to use the expression function of the “flow” plugin alongside it instead of linear or ease, this will be amazing. I guess I badly need to enhance my coding skills in some way.

  • Brie Clayton

    June 16, 2024 at 4:21 pm

    Thank you for solving this, Dan!

  • Patrick Grossien

    June 17, 2024 at 11:04 am

    If I may further ask for your assistance, is there a way to modify it so it also does a loopIn as this would further make randomizing easier? trying to still wrap my head around the modulo in this instance.

  • Dan Ebberts

    June 17, 2024 at 6:08 pm

    So in this scenario, the keyframes would all be moved to the right so that there is time before the first keyframe, is that correct?

  • Patrick Grossien

    June 18, 2024 at 8:10 am

    If easily possible, yes.

    Of course it’s possible to offset them to the left and out of sight, but this way it would be clearer to see what’s happening. Didn’t think about it at first but quickly changed the loopOut to loopIn and Out

  • Patrick Grossien

    June 18, 2024 at 8:42 am

    Weird. Further trying to extend the possibilities I tried to also place the same script into the “end trim” parameter. But there the value of keys 1 and 2 is changed to the value of the script result and key #3 gets the value of keys 1 and 2. So it seems to be offset!? But even changing the key(#) values never returns the correct result… so weird. but why? 😂

    But I’ll just try to skip this for now….

Page 1 of 2

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