shinsuke matsumoto's blog thing.

After Effects Tips: Loop With Expression
You mographers probably use a simple loop expression, “loopOut()”. And I think once you’ve thought that you wanted to loop only specific keyframes like an image above. It’s easy to do with expression!

[Expression]

loopOut("cycle", 2);

 

[Quick Explanation]

loopOut(type="cycle", numKeyframes=0);

loopOut() has 2 arguments, loop type and number of keyframes. The number of keyframes is keyframe segments to loop. If you use “loopOut(“cycle”, 1)”, it loops the segment bounded by the last keyframe and second to last keyframe. See my quick expression sample GIF below. Of course, you can choose your loop type from cycle, pingpong, offset and continue.
Anyway, I recommend you to read the Adobe Help page about loopOut() expression once.

After Effects Tips: Loop With Expression Sample

I would much appreciate it if you could give me a feedback. So please don’t hesitate to get in touch with me if you find some errors or better ways.
I hope this tips help you out even just a bit.

Advertisements

13 Responses to “After Effects Tips: Loop With Expression”

  1. gabivallu

    after year now i finally understand what I do when using loopOut. now I wonder how to say at the expression that I want to loop between specific keyframes ( lets say, between the second and 4th keyframe in your example), without need to use sliders, duplicate comp layers and these sorts of things. Thanks!

    Reply
    • beatgram

      Thank you for your comment. I’m glad if it’s helpful for you.
      I’m sorry but I’m not sure your goal. But “if/else” conditional might be useful for some cases.

      Reply
  2. Gustavo G. Forster

    Very good explanation, thanks! I gotta a question.. What if I want to make an animation loop until it reaches a certain point in time? Is that easy to achieve?

    Reply
    • beatgram

      Thank you for your comment, Gustavo.
      It depends on the situation/condition but how about this expression?

      t = 10; // set your time to stop loop
      if(time < t){
      loopOut("cycle");
      } else {
      value; // or something you want
      }

      Reply
      • Dilpreet Singh

        Thanks a lot Beatgram, this is a cool code snippet. Sheer genius!!

      • Akvile

        Thank you!! That’s just incredible. It’s my first day of learning After Effects and I already feel like a programmer :))

  3. Akshay Asarkar

    Exactly what I was looking for ! Thanks alot !

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: