Looping Animated Scenes in Adobe After Effects | Megan Friesth | Skillshare

Looping Animated Scenes in Adobe After Effects

Megan Friesth, Motion Designer

Looping Animated Scenes in Adobe After Effects

Megan Friesth, Motion Designer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
24 Lessons (2h 11m)
    • 1. Welcome

    • 2. Class Project

    • 3. What is a Loop?

    • 4. How to Use Loops

    • 5. Planning Your Loop

    • 6. Seamlessness

    • 7. Working with GIFs

    • 8. Tour of the Project File

    • 9. Loop Expressions

    • 10. Apply Loop Expressions: Seaweed

    • 11. Overlapping Action

    • 12. Loop the Wave Warp Effect

    • 13. Animate Other Seaweed

    • 14. Apply Loop Expression: Angelfish

    • 15. Apply Loop Expression: Other Fish

    • 16. Advanced Loop Expressions

    • 17. Loop Compositions Seaweed

    • 18. Loop Compositions: Fish

    • 19. Loop CompositionsL Sporadic Fish

    • 20. Add Final Details

    • 21. Animate School of Fish

    • 22. Rendering a Video

    • 23. Rendering a GIF

    • 24. Wrap-Up

24 students are watching this class
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Learn how to create seamlessly looping animations for websites, social media, or as part of longer, narrated animations.

Animations that loop can be mesmerizing! There’s just something satisfying about watching and making looping animations. But, if you’ve ever thought about trying to make an entire animated scene loop seamlessly, then you know that it can be overwhelming to figure out how to time everything just right.

While this class will have step-by-step instruction in After Effects, it's much more than that. I'll explain the thought process behind the techniques used, to help you think like a motion designer and enable you to apply these ideas to your future work.

In the first part of this class, we’ll talk about the conceptual side of making looping animations and discuss best practices. You'll learn:

  • the difference between looping animations and gifs
  • when and where to use different file formats
  • how to plan out your loop
  • how to decide how long your loop should be
  • best practices for looping animations
  • how to make sure your loop is seamless (and what exactly that means)
  • best practices when working with gifs

Then we’ll dive into After Effects to animate a looping underwater scene. You can download a partially animated After Effects file (from the "Projects and Resources" tab) so that we can focus on making these animations loop. You'll learn how to:

  • use different loop expressions (no previous experience with expressions is necessary!)
  • add overlapping action/follow through to looping animations
  • loop a composition
  • offset looping elements within a scene
  • make sure that every element within a scene loops perfectly
  • render a video file
  • render a .gif file

Plus a lot of time saving tips!

This class is for intermediate motion designers. If you’ve never used After Effects before, first check out my orientation video. I'd also recommend checking out one of my beginner classes first:

By the end of this class, you'll have the skills and know-how to tackle simple to complex looping animations and understand when to use different techniques to work smarter, not harder.

After this class, check out some of my other classes:

Find me online:

My website




Meet Your Teacher

Teacher Profile Image

Megan Friesth

Motion Designer

Top Teacher

Hi! I'm Megan Friesth, a motion designer and illustrator from Boulder, Colorado. For my job I create explanimations–that is educational animations–and here I create education on how to animate! I have degrees in physiology and creative technology & design. By combining these two disciplines I create explanimations that help patients with chronic diseases understand complex medical information and take control of their health. When I'm not inside Adobe Illustrator or After Effects, I love traveling, running, skiing, yoga, and doing craft projects.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Welcome: Hello and welcome to Looping animations in After Effects. For something satisfying about watching and making looping animations, have you ever found yourself staring at an animation for far too long, fully realizing that you're seeing the same thing over and over, yet still not being able to look away? Looping animations is can be mesmerizing as a standalone piece on social media. But using looping techniques within longer narrated animations can be inefficient way to work. But if you've ever thought about trying to make an entire animated scene loop, then you know that it can be overwhelming to try to figure out how to time everything just right. I'm Megan Friesth and I'm an Explanimator. I may have made-up that word, but I write, illustrate and animate, educational animations mostly on health and environment related topics. In this class, I'll show you the techniques that I use all the time to work more efficiently and make seamlessly living animations for the web, social media, and explanimations. While this class will have step-by-step instruction in After Effects, it's way more than that. I've explained the top process behind the techniques that I use to help you think like a motion designer and enable you to apply these ideas in your future work. In the first part of the class, we'll talk about the conceptual side of making looping animations and discuss best practices. Then we'll dive into After Effects to animate a looping underwater scene. I'll provide you with a partially animated After Effects file, so we can focus on making these animations loop. We use different loop expressions to quickly in the flowing seaweed and swimming fish, without setting a bunch of repetitive keyframes. Don't let the fact that we'll be using expressions scare you. The loop expression is like the kiddie pool as far as how deep you can get with expressions. I'll show you exactly what you need to know to start using these expressions in your work. Next, I'll show you how to add overlapping action to make your animations look more realistic while still looping perfectly. Then we'll bring our seaweed and fish elements altogether in an underwater scene. I'll show you how to offset different elements within the scene to create a stylized, yet realistic underwater scene, that loop seamlessly. These techniques work on land too, or in pretty much anything else you may want to animate. This class is perfect for beginner to intermediate motion designers. If you've never use After Effects before, check on my orientation video, which you can find the link too below this video. I also recommend checking out one of my beginner classes first. By the end of this class, you have the skills and know how to tackle simple to complex looping animations and understand when to use different techniques to work smarter, not harder. So if you're ready to create a seamlessly looping animated scene, let's get started. 2. Class Project: The project for this class is to create a seamlessly looping animation containing multiple elements that move. In the projects and resources tab, you'll find an After Effects project file for my underwater scene that you can download. I'll be using this file as a starting point and showing you how to make each animated element loop. In this project file, I've already set some key frames to animate the seaweed and fish's fins, but nothing is moving yet. If you download this project file, you can follow along with me step-by-step. Feel free to upload this animated underwater scene as your class project or create your own fish and seaweed and use that. Or you can illustrate and animate your own scene that doesn't involve fish or seaweed. Your scene doesn't have to be as complex as mine, just make sure that you're using some of the techniques taught in this class. I'll talk more about rendering and posting your project in a later video. 3. What is a Loop?: Sometimes the terms loop and GIF are used interchangeably, but they're not actually the same thing. Moving animations are often called GIFs because GIFs tend to be short looping animations. But a loop is any animation that loops while GIF is actually a file format. Any file format can loop, it's just up to the video player to play it over and over for you, and the animator to make the animation look like a seamless loop. GIFs, as a file format, don't have to loop and they actually don't even have to be animated. But in that case is just like an image, so it's like what's the point? The biggest differences between videos and GIFs include that videos can have sound, while GIFs can't. GIFs usually play automatically on websites and in messages like e-mails and texts. Then it's up to the video player whether or not a video plays over and over again, whereas with a GIF, it's up to the creator. You decide if you want the GIF to loop forever or just play once. Then finally GIFs have a more limited number of colors, and I'll talk more about that in a later video. This class will focus on creating seamlessly looping animations that can either be rendered out as a video, a GIF, or both when you're finished. Since there are some additional things you'll want to consider if you know you want to create a GIF, I'll cover that in another video. But first, in the next video, I'll go more in depth on when to use different file formats and where. 4. How to Use Loops: There are many cases when a looping animation can be useful. Some cases are more obvious than others. Let's go through a few. Since many social media platforms like Instagram and Facebook will automatically play a video through and then immediately play it again, or in other words, make it loop, is that it makes your animation look more polished and professional to create it as a seamless loop. I've compiled the summary of specs for the most current popular social media sites. Since the size or aspect ratio of video seems to change more frequently, I didn't include it here, but it's always easy to Google. Facebook supports GIFs and auto plays and loops videos. Instagram doesn't support GIFs, so MP4 are best. If you work like I do and usually create an MOV first out of After Effects and then try to AirDrop that MOV to your iPhone, it won't save in photos. Since you can only post to Instagram from a phone, even though.mov are supported by Instagram, it's hard to use a.mov. If you just use an MP4, you can AirDrop and upload to Instagram without problems. On Pinterest, videos will autoplay when they're in someone's feed, when they're 50 percent in view, and the loop when they're in the feed. But if the user clicks on the video to see it close up, it won't actually loop. Strangely, GIFs won't autoplay on Pinterest, but when the user clicks on the GIF to see it close up, it will loop. You just have to weigh what you want the experience to be with your looping animation and then choose accordingly. Looping animations are also useful on websites. GIF files will automatically play in loop forever. You can also set a GIF file to only play once, and it will do this as soon as the file loads on the webpage. I'll show you how you can set this when exporting GIF through Photoshop in a later video. With GIFs, you don't have to deal with uploading the animation to a video player like YouTube or Vimeo. You can just treat a GIF like it's an image, except it's a moving image. Another sometimes nice thing about GIFs is that they won't display a play or pause button over your animation. That also means that the viewer can't pause your animation, so try to use GIFs in the way that's not going to annoy or distract your viewer. If you use too many GIFs on one page, it can be a bit overwhelming for the device and your viewer. Your viewer might see some error message like the page is being slow or something. Just be mindful of that. When using GIFs, you have to be careful about the file size because too large of a GIF might not be supported. For example, I use webflow for my website and it only allows me to upload GIFs that are less than four megabytes. That's a good rule of thumb to keep in mind. Even if large GIFs can be uploaded, they may take a long time for the viewer's device to load it. Then in the meantime, it may play back slowly, or look choppy. I'll talk more about best practices for GIFs in a later video. GIFs can also be fun for texting or emailing. They'll autoplay and loop in text messages and emails, whereas videos will display a play button and require the viewer to hit play. Another use for looping animations is within a longer animation. This can be a huge time saver. You can loop animations on a keyframe level or loop entire compositions. I'll be showing you multiple ways to do both later in this class using the fish seen as an example. If you're using looping keyframes or compositions within a longer animation and you decide you want to change something, you only have to make the change once. Whereas if you had a bunch of repetitive keyframes, you'd have to make the change many times. Looping animations can be super efficient. I was recently working on an animation for an educational program I was creating. I knew I was going to need a looping GIF for the webpage, but I also wanted to use the same animation within a longer animation with a voiceover. I didn't know how long the segment would need to be for the animation with the voiceover. I created a looping animation that can be used in both cases. Since this animation moved, I could just loop this segment within the animation with the voiceover and it would work for any amount of time I ended up needing it to be. 5. Planning Your Loop: In this video, I'll talk about the things to think about before you start animating your loop. The first thing you should figure out when making a loop, or really any animation, is what the goal is. Be intentional. What do you want someone to feel, know, or do after watching your animation? Or is the goal just to practice your animation skills and make something beautiful? That's a perfectly good goal too. The first step should really be to storyboard your idea. Yes, even if it's only going to be a few seconds. So often I find that when I try to put my ideas on paper, they're really not as complete as they seemed in my head. Storyboard help to get ideas out before you get too deep into animation and realize things aren't working. It can be as simple as just sketching out a rough idea, and it will help you to figure out point number 2, which is to consider how long the loop will be. In general, it's good to use the shortest amount of time feasible to keep the file size small, which is mostly just important if you'll be rendering out a GIF. But too short of a loop can look too repetitive, although really depends on the content of your animation. For example, this loop is only two seconds, which I think works well for these penguins in how they're moving. If you can get away with a short loop and you want to render out a video, watch out for minimum time requirements. You can always just put your composition into another composition and loop the precomp a few times, which I'll show you exactly how to do in another video. But sometimes if you have multiple different elements in your animation, like this example, it would be a bit boring and predictable if everything happened at the exact same time. Just so that I can make this GIF short, like say, four seconds. The next thing to consider is if your animation will have multiple elements that loop at different frequencies and how long you should make your animation, so that you can accommodate all the different elements. For example, are underwater scene has multiple different pieces of seaweed and multiple fish. Even though the seaweed is not synchronized, they're staggered to look more realistic. They each take eight seconds to complete one full cycle or one full loop. The animation on the body, tail and fins of the fish take one second, 10 frames. For the tiny fish in the school, one cycle takes one second. The fish and the seaweed are looping at different frequencies. How did I decide how long to make this scene as a whole? Since the seaweed takes the longest amount of time to loop, eight seconds, I needed to make my scene eight seconds. Pretty simple. But I could've made my seaweed loop in any amount of time I wanted, so why eight seconds? One of the reasons was that eight seconds was a good amount of time for a fish to make it all the way across the scene. Another reason is that I found for scenes with multiple elements that loop at different frequencies, choosing a whole even number that divided in half is another whole even number works out well. Let me explain what I mean with an example. Let's take eight seconds. It'll take eight seconds for our entire scene to loop. I can obviously have elements within the scene that takes eight seconds to loop. I can also have elements that take four seconds to loop, because eight divided by 2 is 4. These elements will complete two cycles within the eight second scene. I can also have things that take two seconds to loop because 4 divided by 2 is 2, and so on. I can have things that take eight seconds to loop, to four seconds, two seconds, one second. It can even go down to 20 frames, 15 frames, 10 frames, and so on. Whereas a not-so-good example would be if you chose number like seven seconds for your entire loop, you could have things that take seven seconds. You could have things that take three seconds and 15 frames, and then what's half of that? Things just get messy. To recap, if you have a scene with multiple different elements that loop at different frequencies, then you're going to need choose the longest amount of time that one of those cycles takes. In my case, for the underwater scene, that's eight seconds because it takes the seaweed eight seconds to complete one full cycle. Choosing an even number that divided by two is another even number ends up working out nicely with the math so that you can have multiple different possibilities for how things can loop. 6. Seamlessness: You've heard me say seamless a few times by now. That's because hiding the spot where animation ends and then begins again, can make your animation look more polished and professional. It's like good pattern design. You don't want it to be obvious where the edge of the pattern is. It looks nicer when the seams are hidden. For looping animations, sometimes it's not possible to do this and that's definitely not bad or wrong. The koala and panda animations here, you can probably guess when the animation is repeating again. But it works with the fact that these guys are eating. Eating is a repetitive movement. Whereas in the underwater sea you probably can't guess exactly where the loop begins and ends. Again, it just depends on the content of the animation. What's not so good is to have an obvious jump. Notice how on this example on the left, the leaf that the Koala is eating just pops in and out. He eats the leaf and then another one just pops into this screen. You can see that that's the seam of my loop. But in my seamless example on the right, I animated the leaf that the Koala eats coming out from behind another leaf and moving into place so that it doesn't just pop in when the animation loops. So when you're planning out your animated loop, think about how you're going to make the seams hidden, or if it's okay that it's not hidden. Just make sure that you're not going have any obvious jumps when the animation ends and then begins again because if you do, it's not really a perfect seamless loop. That's what this class is all about. If you zoom in within a loop, you're going to have to zoom back out or vice versa to make it loop. If you zoom in and out quickly in your animation loop, so it happens over and over again, it can give your viewer like motion sickness. So my recommendation would be either don't zoom or make your loop long enough that your zoom in and out can be slow enough to look good or have enough time in between the zoom in and out, that it's not going to be jarring to zoom in and out a bunch of times quickly in a row. Zooming in and out can also make it more obvious where your loop ends and begins again. That's something to consider. Working with positions or cameras panning can also be a similar story. That's why it's a good idea to storyboard your idea to plan out your animation in advance. In order to make the loop, you have your scene or illustration, or in this case, a very simple example. In this state at the beginning, [inaudible] animates and returns back to the identical state it started in. But in order to make a perfect loop, your first and last frames should not be the exact same. Your first and last key frames are likely the same, but your first and last frames should be one frame apart. If they were the same, then when the animation plays over again, you'll have two identical frames played back to back, and that's not a perfect loop. So what you need to do is trim your work area one frame before the end, so that this last frame is actually not going to play. They'll just stop here and then go back to the beginning. That way we will only see this 0, one time through. If I play this back in really slow motion, like I'll just put this at playing back at five frames per second, then we can see how the numbers count, but we don't see 0 twice. You also notice that this composition is one frame longer than two seconds. I made this two seconds in one frame. The reason I like to do this is so that I can reach two seconds with my playhead and put a key frame on there, and also it works out if I want to make this composition loop. I'll explain more about all of that later. But when we're playing back the animation in this timeline, we just want to make sure that the work area, which is this gray bar, is trimmed at two seconds, so when it plays back, it doesn't play the last frame. 7. Working with GIFs: As I mentioned in previous videos, when you're working with GIFs, you'll want to make your file size small enough that your animation loads and play smoothly. But you'll also still want your animation to look good. The goal is to find the right balance between quality and file size. Here Here some of the things to keep in mind. First, the longer the animation, the bigger the file size. The greater the dimensions, or in other words, the more pixels the bigger the file size. Also, the greater the frame rate, the bigger the file size. I like to use 30 frames per second for animations rendered as video files. If I have a GIF that's short, I'll stay at 30 frames per second because I like the smooth look this produces. But if my gift is longer or if I want it to look more cartoony or handmade, I'll use 15 frames per second. The more colors in your animation, the bigger the GIF file. When you export your GIF through either Photoshop or the plugin GIF gun, you'll get a choice for the number of colors to include in your final file. If you choose a smaller number of colors than are actually in your animation, your GIF won't look very good. It's best to work with a limited color palette when you're working with GIFs. Along those same lines, gradients, glows, blurs, and animating the opacity of something will require more colors. Every shade of a color counts as a different color. Usually these effects don't look very good in GIFs, so I generally try to avoid them if I can. Textures will also add more colors to your GIF. Flat design is really where it's at for GIFS. The more complexity and movement in your animation, the bigger your GIF file will be. You can think of it as how much each pixel is changing. If you have a solid background where a big portion of your pixels are not changing, your file will be smaller than if you have a background where a lot or all of the pixels are changing often, and notice how both of these GIFs have the same number of colors. Basically aim for simplicity when working with GIFs. My underwater scene is a terrible example of an animation to be rendered as a GIF. You'll notice I didn't follow any of the guidelines in this video to make this underwater scene a small GIF file. The goal with this animation was to demonstrate the many different ways to utilize looping expressions and techniques, so I planned from the start just to render this as a video file and not a GIF. 8. Tour of the Project File: Let's check out the project file that I've provided for this course. If you haven't already, make sure to go and download that under the Projects in Resources tab. All you need is this one After Effects project file, because all of these graphics are just shape layers within After Effects. There's nothing linked in from Illustrator or somewhere else. You might notice that in my final animation, I have textures on the fish and the seaweed. But in this project file that I'm giving you, there is no textures. I did that because this way I can have all of the layers within After Effects and you don't have to have another additional Illustrator or Photoshop file that links these graphics in and also because it's a lot faster to render without the textures. When we're working in the project file, it'll be easier to preview things because there's no textures. Once you have this downloaded and opened, let's just take a quick little tour of what we have here. I've organized all of the different elements into these folders. The main underwater scene is going to be in the Out folder because that's going to be the final thing that we render out, so I like to always keep that in the Out folder. Then we've got some bubbles, some fish, and some seaweed. If you open up the underwater scene composition, you can see that it is eight seconds long. If you play it back right now you can see the seaweed moves a little bit and we have this pufferfish move across the screen. Right now in this project file, the only thing that's really looping is the pufferfish because he appears at one end of the screen and he disappears at the other end of the screen. That's basically the easiest way to make something loop, is to make it appear and then disappear. But in this class I'm going to show you a bunch of other ways to make things loop because if everything just appeared and disappeared, that would be a pretty lame animation. If you click into the pufferfish composition, you can see that I have some keyframe set that animate the fins and the lips opening and closing, and the body moving side to side. But nothing is looping. He just does like one rotation. We're going to go through and make this loop, and the same is the case for all the seaweed and the other fish. I just set some keyframes to save us some time, so I don't have to explain every keyframe that I set. We'd be here for hours. Hopefully that makes it a little bit more efficient for you. You'll also find that in this project file I've provided this little composition called loop expressions. This is like a cheat sheet or a guide on how to use the different loop expressions and what they do. These are all looping expressions that we'll be using in this class. There are more, but I find that these ones are the ones that I use the most. I'm going to explain exactly how to use these so that they won't be intimidating at all in the next video. 9. Loop Expressions: Let's take a look at some of the different loop expressions and see what they do. But first, in case you're not familiar with expressions, and you don't need to be, expressions are short lines of code that you can apply to a property to manipulate that property. Sometimes expressions modify keyframes set on that property. In our case, we'll use expressions to repeat keyframes. Sometimes expressions don't need any keyframes. If that's not totally clear, I have examples that will help. Let's take a look. As a reminder, this composition is within the project file that I provided for this class. Make sure you go and download that, if you want to explore this composition on your own. If I were to play this comp, there's a lot going on and it can make your head spin. Let's just go through each of these expressions one at a time. But first, let's look at the different parts of a loop expression. This version of the loop expression is probably the very first expression that I learned and I still use it all the time. What are the different parts of a loop expression? The first part is the property. In this example, we have loopOut. There's also loopIn. The next thing is the type. In this case, we have cycle. Cycle just means that it'll play the keyframes through and then it will go back to the first keyframe and play it through as a cycle. It'll just keep repeating your keyframes, when it gets to the end, it goes back to the beginning. You'll see what that looks like in just a second. Then the last piece is a modifier, and this is optional. I often don't need a modifier. If you don't need a modifier, you can just set it to zero or you can just leave it out, because zero is default. Also cycle is default, but I usually just write it, just so that I know that I did it intentionally. Let's go back to our After Effects composition, and let's take a look at each loop expression. Let's first look at loopOut cycle. Let me zoom in on this. If I go to this layer, I've named all the layers with the expression that is controlling its position keyframes. This loopOut, I'm going to hit P to see the keyframes on my timeline. You'll notice that these position numbers right here are red. Normally, they're blue, so when they're red, it means that an expression is controlling them. If I just toggle down, you can actually see the expression. I have the loopOut cycle expression here. I'll be showing you how to set an expression on your layer in the next video. But for now, just know that there's a loopOut cycle expression set on this circle shape. As you can see, I have four keyframes here. My first keyframe is actually the same as my last keyframe. It just makes this circle move in this triangle motion. You'll notice that as I pass my last keyframe, the circle is still moving, and that's because I have the loopOut expression on it. The loopOut property makes it so that the animation is repeated after the last keyframe ends. The type being cycle makes it so that when the playhead reaches the last keyframe, it goes back and plays the first keyframe all the way through again, and it just cycles through the keyframes, like what I just did with my playhead. When I play this back, you'll see that there was no motion before I got to the keyframes, and that's because I'm using the loopOut expression. But then, it'll play the keyframes and after the keyframes, it'll just keep repeating those keyframes over and over and over. Now let's compare the loopOut expression to the loopIn expression, both with the type set to cycle. I'm going to select my loopIn cycle layer and hit P to see the keyframes. You'll see that I have keyframes starting at five seconds. If I play this back, you'll notice that I have motion before the keyframes, and that's because I'm using the loopIn expression. The loopIn expression will loop your keyframes before your playhead actually gets to the keyframes, whereas the loopOut expression will loop your keyframes after the last keyframe. In both cases, the type is cycle, so it's going to play the keyframes through in a cycle. Once it gets to the last keyframe, it'll go back to the first keyframe. Now let's look at the loop expression with the type set to pingpong. Let me zoom in on these. On the loopOut expression, you'll see that there's no movement, until it gets to the keyframes. Then it plays the keyframes. Then after the keyframes, it's going to go back and just go back and forth between those two keyframes. I just have the two keyframes, and it's just going to go back and forth between those two keyframes. The loopIn expression with pingpong is going to play the two keyframes back and forth before I actually get to the keyframes. Then after the keyframes, it'll just stay still. If you play both of those back, you can see the difference. Basically pingpong, it's just like the sport ping pong, where it's going back and forth between keyframes. You can have more than two keyframes. It will just go through all of the keyframes and then back in the reverse direction. It just goes back and forth between all of the keyframes. The last type of expression that I'm going to cover in this class is using a modifier. Let's first look at the loopOut cycle with a modifier of three. Let me zoom in. Let's just toggle this down and see what we're working with. I have five keyframes set here. The first one is going to start the circle up here, away from this triangle shape, and then it's going to move down into the first point of the triangle, then move up to the right and back to the start of the triangle. What this modifier is going to do, if I play back this whole animation, you'll see that the modifier is making it so that it just repeats the path of the triangle. After the circle drops in, then it makes the shape of the triangle. Then my loop expression is only looping those keyframes that make the circle move in this motion of a triangle. This loop expression with the modifier of three is going to repeat the last keyframe and the three previous keyframes. You might think it should be a modifier of four, but that's why, it's because it's the last keyframe and the three before that. Once the playhead gets to the last keyframe, it's going to jump back to this keyframe, so three from the end, so 1, 2, 3, from the last keyframe. That's why I have modifier of three. Again, if we play that back, I'll just play it back in slow motion for you. It's going to drop down and then move in a triangle. Then the part that repeats is just those last four keyframes. It's the last keyframe plus the three before that, and that's why you have a modifier of three. That allows me to make this unique animation that loops the triangle portion of the motion, but not that first keyframe. You can already imagine how this might be useful, and I'll show you an example of how we can use it in our underwater scene example later in this class. Let's take a look at one more example that uses a modifier. For this example, I have the loopIn expression with the type of pingpong and a modifier of one. Keep in mind that you can mix and match these pieces. These are just two different examples. Let's go in and hit P and see what we're working with here. I have three keyframes set. This is a loopIn expression, so it's going to loop the first keyframe and the one after that. That's why I have a modifier of one, over and over, until it gets to the keyframes, and then it'll play through the keyframes, and then stop. Let's see what that looks like. It drops down, it goes back up, down, up, because that is what this keyframe and this keyframe are, and then it moves to the right, and then it stops. It pingponged between these two keyframes before the keyframes, because it's a loopIn expression, because I have pingpong, and because the modifier is one. Again, the modifier of one is because it loops the first keyframe in this case and the one after that. If this was a loopOut expression, it would loop the last keyframe and the one before that. That's how you get a modifier of one. It's always the last or the first keyframe, depending on if you have a loopIn or a loopOut expression, and then the one or however many you have in your modifier, before or after that. This is still a little bit fuzzy and confusing to you. Make sure you download this project file and play around in this composition, just play things back in slow motion. Think about what's going on. Think about what the expression is telling After Effects to do with the keyframes, and I think you'll be good to go. Keep in mind that the modifier, which is this number at the end, is optional. You can just leave it off if you don't need to do anything fancy, like skip some of the keyframes in the loop. 10. Apply Loop Expressions: Seaweed: Let's apply some of those looping expressions on seaweed and fish in our underwater scene. You'll see in this scene, some of these layers are compositions and some are just shape layers. Like this piece of coral, it's not actually going to be animated, so it's just a shape layer. This vine right here, the seaweed vine, it's just a shape layer and we're going to animate that as a shape layer. But then other layers in here are actually compositions. This seaweed-vine1 is a composition, so I'll just double-click on that to get into the composition, and you'll actually see another composition within this composition. But within this composition of the seaweed, I've added a bend effect. Just in the Effects & Presets, I've added CC bend onto this whole composition, which contains all of the different pieces that you currently use in stem of the seaweed. In this seaweed-vine1 composition, I have this bend, and I have the keyframe set already so that this will all play bending to one side in four seconds. Now I want to get this back to this position in the remaining four seconds of this composition. You might have already guessed what expression I'm going to want to use on these keyframes. I want to go back to this keyframe, so I'm just going to use the ping-pong expression. I'm going to set an expression by holding down Option or the Alt key and clicking on the stopwatch, and that's going to open up this expression little typing area for me. I'll just go in and type loop, and I'm going to use loopOut, so make sure you're typing with a capital O for out. Then After Effects is pretty good at guessing what you mean, so I can just hit Enter and that'll finish the loopOut, and it'll give me those parentheses. Then I'm going to use the quotes, and then I can either choose from this list of the different types of expression that I can use, or I can just start typing and then hit Enter. You need to make sure that your expression looks exactly like this when it's typed in. After Effects is really good at helping you out and guessing what you mean unless you're on a really arcade version. Let's play this back and see what it looks like. Perfect. So we've made our first loop, but you may have noticed a little jump at the end when it comes back to zero, and that's just because we haven't looped the leaves. So let's go into this composition and let's check out what we have here. I have a bend effect on each leaf and I also have a rotation effect or just keyframes on the rotation property for each leaf and these keyframes are not looping. What we need to do is apply a loop expression to all of these keyframes. Again, to add an expression to a property, Option or Alt, click the stopwatch, type in loopOut and then "pingpong". So using that same expression, and then click out, and now this top leaf is going to be looping for the bend of the leaf, but not their rotation, so let's do that. LoopOut and then "pingpong", and now this top leaf is going to be looping, so we can just play that back just to double-check really quick. Top leaf is looking good, except you will see that it jumps at the end. That's because we have this blank frame right here, and that's because our layers end. So let's just make sure that we extend all of our layers to the very end. Now they're visible again, but this brings up another important point. If I hit, "Command K" to see the composition settings, this composition is eight seconds and one extra frame. There's a reason why I like to accept one extra frame, and that's because when you loop a composition, which we'll learn how to do later, it helps to have this one extra frame so you don't have things disappearing. I'm going to cover that in way more detail a little bit later when we loop compositions. But just know that right now I have this competition for eight seconds and one extra frame. So when I play this back, it's not going to be a perfect loop because I have an extra framing here. What I'm going to do is just take my work area and drag at one frame forward. Now my last frame should be at 7:29. That's the last frame that it's going to playback when I'm previewing, in that way it'll loop perfectly. It's just something to be aware of when you're previewing animations. This will make a little bit more sense later as I said. If you ever are having an error message because one of your expressions is wrong, you'll probably see a little orange bar right here. Just double-check that you have everything typed in correctly and maybe even just delete it and try again. We want to apply this loopOut-pingpong expression to all of our other key in this composition. One little tip that we can use to save time is to select both of these properties. Hold down Shift to select both of them. All of your keyframes should be blue on this layer, and then go up to Edit, Copy Expression Only, and then click all of your other layers except for the stem, to all the other leaves, and then hit Command-V to paste, and you can see that it's pasted all of those expressions onto all those layers. We didn't have to type it out a bunch of times. Now if we play this back, it should be looping. Looks good. If we go back into the main composition of this seaweed and we play the whole thing back, we should have a perfect loop where the whole seaweed bends and all the leaves bend a little bit and rotate a little bit on their own as well. Just a quick note is that this composition is eight seconds. 11. Overlapping Action: We have our first seaweed vine looping, but everything moves at the same time. The leaves and the main band on the seaweed is all happening either at zero frames, four seconds or eight seconds. Let's compare this seaweed with the seaweed that I have in my final animation. Here's the one for my final animation on the right, you can tell because it has the texture on it, and on the left we have the seaweed that we just made loop. If I play this back, see if you can notice the difference between the two. In the seaweed on the right, I've added overlapping action. You could also call this follow through. What this means is that not everything is moving at the same time. If I play this back nice and slow, we can see how the main seaweed is bending. When it gets to its most bend position, which is about here, the leaves are not in their most bend position. They are a little bit behind, so they're still moving to the right. Even though the seaweed as a whole is all the way bend to the right. Leaves are still going, and then the whole seaweed is going to start bending back to the left, and the leaves are starting to move back to the left. Now they started just a little bit later. What I've done here on this seaweed on the right, is I've staggered the keyframe so that not everything happens at the same time. If you're looking at these two animated pieces of seaweed and you're not really seeing the difference that I'm talking about, don't beat yourself up about it. It's totally normal for you to take a lot of practice and time to be able to develop an eye for animation so that you can see these subtle differences. I've created this illustration in the middle, I've overlapped two seaweeds and colored the one with overlapping action. That's the one that you see on the right. I've colored that with red. Now we can better see the difference in the timing of the leaves. I've offset this layer so that the main bend on the main seaweed is happening for both of these two seaweeds at the same time, and also in case you weren't sure there's a seaweed under there, and that's the one on the left. Let's play this back, and see the difference in the leaves. You can already tell right here and right here, just like on the edges of the leaves, you can see that the green leaves, which are the original version with no overlapping action are a little bit offset from the red leaves. When I play this back, you can see that the red leaves, which are the ones with overlapping action, are a little bit behind those green leaves that don't have the overlapping action. Making this animation offset like this, makes it look a little bit more natural and realistic. Now let's go into this seaweed and add overlapping action. First I want the bend of the entire seaweed to happen just a little bit sooner. I'm just going to select both of these keyframes and drag them backwards or to the left, to about three seconds for this last keyframe. It's okay that my first keyframe has now disappeared. It's off-screen. Because we have this loopOut expression that keyframe is still being calculated when it plays back. If we play this back now, you can see that it's already looking a lot better. The leaves are already waiting a little bit before they start moving. Because we've moved up the bend position to be earlier on this entire seaweed. That was just a small change and it looks a lot better, a lot more natural. It still looping perfectly. When you animate, you should always be thinking about why something is moving and that will help inform you on how to animate something to make it look more realistic or natural. For this seaweed, the reason why it's bending back and forth is because of the waves in the ocean. I can add a little bit more overlapping action to this to make it even more interesting. If I go into my pre-comp, I'm going to make the leaves on the top go before the leaves on the bottom. Because the leaves on the bottom are closer to the stem that's anchored into the ocean floor, they're going to be a little bit stiffer and they're going to move a little bit later. If you're imagining the ocean pushing the seaweed, it's going to push the top first because that's the least stable. It's further away from the anchor of the stem into the ocean floor, so it's going to move first, and then when that moves, it's going to be pulling the rest of the seaweed. The top will move a little bit before the bottom. Let's make these top leaves move a little bit before these bottom leaves. First I'm just going to hit U on my keyboard a couple of times to hide those expressions and then show my keyframes, and I want my top leave to move first. We're good with these keyframes. Then I want to offset the second two leaves by a frame. That's going to be leaf 8 and leaf 7. I'm going to select all these keyframes and just drag them one frame forward in time. Then I'm going to take these next two leaves and drag these ones, two frames forward. Then the next set is going to go three frames forward. You can also hold down Option or Alt and then just hit the Up arrow key on your keyboard to move your keyframes. That will be there, and then the last leaves are going to move four frames forward. Let's play this whole thing back. That's looking a lot better with the overlapping action that we've added just by staggering our keyframes. The annular seaweed that you will also find in the seaweed folder is going to work the exact same way. It has a bend on the entire seaweed, and then each little segment or antler as I called it, because it was like an antler, is going to have a bend in a rotation keyframe. Since this is going to work just like the vine that we just did, you can go ahead and skip to the next video or if you want a refresher, go ahead and keep watching and I'll show you how to do that one more time on this antler seaweed. The final antler seaweed should look like this. 12. Loop the Wave Warp Effect: The next piece of seaweed that I'm going to animate is this fancy weed. This seaweed doesn't actually have any animation on it. What I'm going to do is go over to my Effects and Presets Panel, and just look for the wave warp effect, so make sure you're getting wave warp and not like wave world. Then you're going to drag the wave warp effect onto one of your leaves. I'm going to start with this leaf 3, because it's up and down and that's going to make it easiest to see what's going on. I'll drag that onto this layer, and now in your Effect Controls panel that should have opened automatically, but always you can find anything that's missing in here in the Window tab. What this is doing if I play this back, it's morphing the seaweed in a wave-like motion. Let's just solve this one leaves so we can really see what's going on. This is not how I want this to be animated, I want it to look like the waves are pushing the seaweed back and forth. What I'm going to do is adjust first the direction, this is moving at 90 degrees, I'm going to make it at zero. You can already see that that's more the effect that I was going for, something like that. But obviously the bottom of the seaweed wouldn't move so much like it is now, so I need to pin the bottom to the bottom edge. Now, it's anchored down here like seaweed would be in real life. But this is a little bit too wavy, so what I can do is go in and adjust the wave height. I've already done this, so I know that four looks good, but just play around with values if you're working with the different pieces seaweed or you want a different look. Now the last thing to adjust is the wave speed, and this is how we're going to make the animation loop. Let's just play back what we have right now, this is going a little bit fast, so I'm going to need to slow it down. But you'll notice that it's already looping perfectly, so I need to slow down, but I also want to make it still look. Let's see how we can do that without messing up the loop, and the reason why this is looping is because the wave speed is set to one. Every one second, this is going to make one cycle, if your comp is any duration that's divisible by one, then this will loop. If I were to set this to seven, you'll see that this is also going to loop. If I want to change the speed, I just need to be mindful that I'm setting the speed to a number that's divisible by the length of my composition. In this case, the speed is what we're adjusting, so the speed is one cycle of this wave, you can see that one second is the same as zero. If I set this to 0.5, which is a slower speed than one, this is going to take two seconds to make one full cycle, so you'll see that two frames is now the same as one frame. An even number would be divisible by a speed of 0.5. But this is still a little bit too fast for what I want, I'm going to have this speed again, I'm going to go down to 0.25, which will double the time that it takes to complete a full cycle, so now that's going to be at four seconds. If we play this, you can see that zero and four seconds are the same, and that's divisible by eight seconds, we'll make two cycles in the eight seconds. If we play this back, it'll still loop perfectly. But it's now going a lot slower, which is more realistic for my scene. Now you know how to loop the wave warp effect, just find a speed that makes one full cycle of a wave happen in an amount of time that's divisible with the length of your composition. In this case, 0.25 is going to take four seconds to make a full cycle of the wave and four seconds is divisible by eight seconds, obviously, so that's why this is going to loop perfectly. Now, let's apply this looping wave warp effect to all of our other leaves to make this complete seaweed. I'm just going to copy the wave warp effect from the Effects Controls panel and then paste it onto my other three leaves. If I play this back, you'll see that everything is waving at the same time, which looks okay, and if that's the look you're going for that's totally fine. You're done, because this is still going to loop perfectly. But if you want to switch it up a little bit and offset the timing of the waves, you can do that too. Let's just go, and you don't need all these , I'm sorry. One thing I want to do is to adjust the direction of the wave a little bit, because these leaves are rotated. On this first leaf, I'll just take the direction of the wave and align it more closely to the rotation of this wave, and then I'll do the same thing with leaf 2, maybe something like that and leaf 4 is going to be like that, so already this is looking a little bit more varied between the leaves. One other thing that I can do is adjust the phase and the phase is going to not affect how this loops. The only thing that really affects how this loops is the speed, so I can adjust the phase to my liking, that's just where the wave is going to start, and since the speed makes it start and end in the same place, you're good to go. I'm just going to change the phase to something different to make this more varied, maybe something like that, and we'll do the same thing for the other leaves. I like leaf 1 like that. Let's just play this back. You can keep adjusting the phase and the direction of the wave until you're happy with how your seaweed looks, but I'm going to leave mine here. That's how you loop the wave warp effect. Pretty easy. 13. Animate Other Seaweed: If you're working with the file that I provided and following along with me, you should have some of your seaweed now animated in the underwater scene composition. But we have a few more piece of seaweed to animate, so let's do that now. The first one I'm going to work on is this vine 2, and you have a couple different ones in this composition and they're just shape layers. If you hit U on your keyboard to see all the keyframes, you'll see that this layer already has some rotation keyframes on it but we need to make these rotation keyframes loop. Just option click on the stopwatch, and we're going to use pingpong, so it's going to be LoopOut and then pingpong. Now, the rotation is going to loop, and we're focusing on this seaweed right here. I'm just going to solo that so you can see what we're working on. Now, that subtle rotation is going to be looping, but let's also add the wave warp effect to this seaweed to make it have a little bit more movement. I already have this pulled up in my effects and presets panel, and I'm just going to drag the wave warp effect onto this layer. Already, it's looking a little bit strange and that's because we need to adjust the direction of the wave warps. I'm going to make this zero, and that's obviously way too wavy. To make this less wavy side-to-side, I'm actually going to adjust the wave height to three, and then I'll adjust the wave width to adjust how many waves fit on this one piece of seaweed, so only bring this up to 60. Now, it's just like a couple of side to sides rather than as many as we had before. Let's see what this looks like. That looks pretty good. I need to anchor the bottom of my seaweed, so I'll use the pinning and set that to bottom edge, and then I'm also going to adjust the speed. Like the other fancy weed, I'm just going to use 0.25 and that's going to make one wave in four seconds, and then in my total eight second composition, it'll wave in two full cycles. That'll be going the same speed as my fern which makes sense because these are all within the same underwater scene. They should be going about the same speed. That's looking good. I have a few more instances of the vine 2 seaweed in this composition. I'm just going to un-solo this and go find those other instances, and make sure that I loop the keyframes by setting this loop out ping-pong expression, and also copy and paste that wave warp effect. I'm going to first go and select the wave warp, hit Command C to copy it, and then I'm going to select my other seaweeds. I think those are the three, and then I'll just hit Command V to paste. You should notice that it pops up in your effects control so you know you've pasted it. But you can also, with one of your vines that you just pasted onto selected, hit E on the keyword and that'll bring up any effects you have on this layer. I have wave warp, so I know that that was copied and pasted successfully. Now, I'm going to select the rotation. Go up to Edit and Copy Expression Only. Make sure you're copying expression from the actual seaweed that you set the expression on, and then I'm going to select those other seaweed again, and hit "Command V" to paste that expression. If I hit U on the keyboard, you can see that my numbers are red, that means that the expression was pasted in there. Now, the vine 2 seaweed is good to go. Next, I'm going to animate this vine 3 with the wave warp effect. I'm going to select it here, and then to find this on my timeline really easily, one useful shortcut that you can use is the X key on your keyboard, and then I'll just scroll your timeline up so that the top layer will be the layer that you selected. That can be super handy when you have a composition with a lot of layers in it. What I'm going to do with this vine 3 is just to drag the wave warp effect on. Sometimes when you try to drag an effect on and you have a bunch of layers, the timeline starts scrolling and you miss the layer. That happened to me a bunch of time just now, and I'm going to edit all of that out. You don't have to watch me struggle. But what you can do, I just discovered, is that you can actually drag the wave warp effect onto your composition, onto the layer and that makes it a lot easier. Maybe that little tip will help you, it just saved me. I'm going to adjust the wave height to something like five, and the wave width too like 80. Let's solve this to see what we're working with, and I forgot I need to change the direction to zero. That looks pretty good. I'm also going to pin the bottom like always, and let's change the wave speed 2.25. Now, you don't have to use the same settings as me, you can adjust these to your liking. That is looking pretty good to me. I don't have any rotation on this, so the wave warp is the only thing that I need to worry about. Let's just copy this wave warp and find any other instances of this seaweed, and paste the wave warp effect, and there's one behind there. I think I got them all, so we should be good to go with that piece of seaweed. The last one to do is this bumpy seaweed right here. I'm just going to also apply the wave warp effect to that, and for this one the settings I'm going to use are two and 100, and then the direction of zero again, speed of 0.25 again. I know that loops and anchor the bottom. This is going to be a really subtle effect. I don't know if this is a real piece of seaweed but in my imagination, this piece of seaweed doesn't move that much. Just something really subtle. I'm just going to copy and paste this effect onto any other instances of the bumpy seaweed. Now, we should have all of our seaweed animated. I'm not going to animate this coral or this coral because I looked at some reference of coral and they're pretty stiff, so I don't think these really need any animation. I just gave that a second to run preview and now we can play back our seaweed and watch all of it animate. Everything is looping really well. But one thing that you'll notice is that everything is happening at the exact same time. I'm going to show you how to offset your seaweeds to make the scene look a little bit more realistic in another video. If you're really observant, you also might notice that this seaweed is going to the right, while this seaweed and this seaweed are going to the left. The reason for that is because I've reversed the direction of it just by taking the scale and setting it to negative 100 in the x-direction. The reason I've done that is just to quickly and easily add a little bit more variety to these pieces of seaweed without having to recreate them. 14. Apply Loop Expression: Angelfish: In this video, we're going to be moving on to the fish and making them loop. The first fish I'm going to work with is the angelfish. If I hit "U" on the keyboard, you'll see the keyframes that I've already set. The first thing I want to do is just make these all loop. The first key on this fin are going from a rotation of zero in all three directions. You'll notice these are 3D layers because this fish is going to be moving forward and back in the z-axis. That's towards us and away from us because that's how a fish would be maneuvering its way through the water. Even though these are flat layers, they're just 2D layers. I've made them 3D layers by checking this little box right here, and that's going to make it look a little bit more realistic while still utilizing 2D layers. To make these keyframes loop on the fin, I'm going to be using the cycle loop expression. You can see that my first keyframe is zero, my middle keyframe is rotated, and then my last keyframe is zero. You might be wondering, "Why bother to set these keyframes? If I just I'm going back to zero, I could just not have these keyframes and then do a ping-pong expression between these two." Which is true, but if you select these keyframes and look in the graph editor, you'll notice that the easing on these keyframes is not the same. When the fish moves the fin back in towards its body, so that's like from here when it's rotated out to here, I want it to move a little bit more quickly as it gets closer to the body because it's like the fish is pushing the water and pulling that fin into its body quickly to propel it forward. I want the motion of that to reflect what would happen in real life or more closely at least. So I have different easing as you can see from this big graph right here on these two keyframes. Instead of using ping pong, which would just go from here back and forth, I'm going to use loop, which is going to go from here and here, and then back to the beginning and through. That way I can use different easing between these three points rather than just having two points to work with. I'm going to click under the graph editor and go back in, and then just hit option and the stopwatch to type in my expression. It's going to be loopOut and then now cycle. I can just copy that by clicking it and selecting it here, and then paste and paste. Now, let's loop the rotation on the body. This is a little bit harder to see because it's coming towards us and away from us. To see this better, if you go right here where it says one view and go down to two views, you'll see a top-down view. This fish is just 2D layers, like I mentioned, but you can see the line of the layer from the top view. You can see how this is rotated. The bottom of the screen is going to be towards us, and the top of the screen is going to be away from us. This fish is angled with its head closer to us. Then, if you drag over these keyframes, you can see the animation where the fish is moving side to side in order to swim, and the tail is making it like the fish is curved. This piece is the tail here. We need to make the tail and the body loop. We're going to use the loopOut expression with pingpong for both of these. I'll just option-click, loopOut and ping pong, and same thing. If you drag your playhead over the keyframes, you can see this animated with the top-down view and also the normal view. If we play this back with RAM preview, you can see that it's looping seamlessly. Now, we can make this a little bit better by offsetting the different keyframes to make it so that the fish swims more like a real fish would in real life. Although this is stylized, and it's going to be small, so it doesn't have to be perfect. What I'm going to do is just hit "U" on the keyboard to close off all my layers and then U again just to see the keyframes. The first thing I'm going to do is just select all of these keyframes and move them to about one second. That way, I can easily slide them around without them going offscreen over here. If you're animating your own fish or something different than me, then you're going to need to play around with this step to see what looks good. But since I've already done this once before, I know what looks good, so we can just speed through this. I'm going to bring these fin keyframes, two frames backward in time. They start at 28 frames. The fin is going to start animating first, and then the body. Then, I want to take the tail keyframes and offset those four frames to the right. When I play this back, try to notice the subtle difference between the original version where all the keyframes are lined up and this new one where the keyframes are a little bit offset. Remember, noticing these tiny details in the motion takes a while to develop an eye for. If you look at the top-down view and just play this back in slow motion, you can see that the tail is animating a little bit after the body. It's lagging a bit behind. This is like that overlapping action animation that we did on the seaweed. A tail just goes a little bit after the body and the fin is going a little bit before both of those. If we play this back with RAM preview, you'll notice that there's a gap before the animation starts, and we obviously don't want that to be the case. What we need to do is drag all of these keyframes back into place. But if I were to just drag them like this, technically there's going to be four frames here and two frames on this layer, but there's going to be no motion. Technically, that was the case with our seaweed, but it was so not noticeable that I didn't bring it up. Here, it's a little bit more noticeable, so what I'm going to do is really easy. I'm just going to slide my keyframes to the left until the last keyframe to start, which is this one right here, is at zero frames. My keyframes have disappeared, but that's okay because I have these loop expressions on these keyframes. It'll still keep playing over and over, and it'll loop perfectly. For an example, I can just go to zero seconds and then eight seconds. I didn't see any motion in my composition, which means these frames are exactly the same. Now, remember, this composition is eight seconds in one frame, which I haven't explained yet, but I will. Then, to play this back as a perfect loop, I need to cut my composition work area just one frame forward so that when I play this back, it's going to stop at 7:29. That way, I won't see the last frame and then the first frame, which are the same, that would mean that two frames are the same in a row, and that wouldn't be a perfect loop. Now, let's play this back. It should be looping perfectly with some overlapping action. 15. Apply Loop Expression: Other Fish: Making the butterfly fish and the puffer fish loop is going to be really similar to the angel fish. I'm going to go a little bit faster through these. First we have some rotation on the fin. I'm just going to make that loop out cycle and same for the z rotation. The reason this is cycle with three key frames, even though it's going from zero to a rotated state back to zero, is because if you look at the graph editor, the easing is different between the key frames. Then for the body, this is going to be loop out and ping pong. Same with the tail. Then the fin, this fin is behind the fish and you just see it for a couple of frames in a couple of places. It's very subtle, but I just have it there just to be a little bit more realistic and that's going to have that same loop out cycle as the top fin. All right, if we put this back, it should be looping. Again, everything is happening at the same time. Let's offset this animation for some overlapping action or follow through. I'm just going to hit U on the keyboard twice and then just momentarily bring these up to like one second. Then I want the fins, both fins to happen first. I'm going to drag that animation like two frames to the left so that they start animating first and then the body will go next. Then maybe like five frames afterwards, we'll have the tail start animating. If we just play this back, looks a little bit more natural. Again, you can go into your tool views to better see the lines that represent the top-down view of this fish and you can see it going back and forth. Then we need to move these key frame so that we don't have any area right here where nothing is happening, so I'll just select them all and move it so that the last key frame to start, which is this guy right here is going to be at zero frames. Just like that. Now that should be a looping seamlessly and also with that overlapping animation. One last thing that I'm going to do is add a wave warp effect to this bottom fin. I'll just drag the wave warp effect on. Then I'm going to adjust the wave height down to one and then I'll make the wave width a little bigger, like 80. I'm going to make this going negative 90. That way it'll be going in the direction that the fish is swimming. Then I'm just going to pin the top edge and I'm going to leave the speed at one. That just adds a little extra something to the butterfly fish. The puffer fish has a few more layers than our other fish. It also has lips that are going to open and close. If we just play back what we have so far, you'll see that the lips opening close. I just want this to happen two times and I'm going to want to line it up with my bubbles. I'm not going to worry about looping expressions on these lips even though I could use them. It's only happening two times. It's not like a lot of key frames and it'll be easier to adjust when this happens to line up with bubbles and I might want to change the timing based on the rest of my scene later. I'll just leave those as is. I'm just going to close them up to make this a little bit more clean looking. Then the mask on the body is going with the lips just to make it so that the mouth can open so we don't need to worry about that either. That goes with the lips animation, same with the mask on the top of the body. So really all we have to work with is the tail. On the body top we have some rotation key frames to make the fish go back and forth, like towards us and away from us, just like our other fish. On all of these, we are going to use the loop out ping-pong expression. I'll just go and do that really quick. If we apply that back, we've got our fish animating. It looks pretty good. Now it's offset our key frames to add some overlapping animation. I'm just going to close up my layers and then show the ones that I need to again. It's just going to meet these key frames. I'm going to want the fin to go first as usual and then the body's going to go like two frames later and the tail is going to go like four frames later. Let's see what this looks like. Think that looks pretty good. Then I'm just going to take all my key frames. Then I'm going to drag these to the left so that the last key frame to start, which is this one, is going to be at zero frames. Now let's just make sure that this loops. That's looking good. 16. Advanced Loop Expressions: If you've ever watched fish swim before, then you know that they don't actually swim as consistently as we just animated them. We've animated them to be like robotic, they move perfectly consistently but in real life, they move more slow, fast, so fast, and then they glide for a little bit. If you don't have access to the ocean or to a fish tank, I would encourage you to go on YouTube and just look at reference of fish swimming to get an idea of what they look like. This is ironic because this is a class on looping animations, but for my angel fish to swim more realistically and to go slow and then fast, I thought it would be better to actually not use any loop expressions and just keyframe all of the animation. This actual composition is not included in the project file that you can download for this class, but basically all I did was I didn't use any loop expressions and I just copied and pasted the keyframes over and over, but I space them out differently. You can see right here the keyframes are close together, so he's going to be moving quickly right here. Then later the keyframes or more spaced out, so he's going to be moving a little slower. Let's take a look at what my final animation was. In this case, I just needed to make sure that my starting keyframes and my ending keyframes made it so that it looked perfectly. Then for the butterfly fish, I actually found a way to use some looping expressions to save me some time, but still make him swim sporadically. Let me show you how I did that. This is my finished butterfly fish that's not included in your project file. What we're going to need to do is go up to the butterfly fish, and this is the one that we just animated consistently. To swim consistently, we're going to need to duplicate that by hitting command D. Then I'm just going to rename it sporadic to know that's the fish that's not swimming consistently. Hopefully that says both sporadic. Then, I'm just going to open that one up. The first thing that we need to do is just delete all of these loop expressions. You can just toggle down and hit delete. The first thing I'm going to do is select all my keyframes by selecting the rotation and you can see how that selects all the key frames. I'm just going to drag them back to start at about two seconds. You might have noticed that some of my key frames were hiding before the start, so this is going to bring them all together. To make this butterfly fish swim with varying speeds, what I'm going to do is use a loop in expression to make him repeat these key frames from the beginning up and tell these key frames. Then, after the keyframes, I'm going to copy and paste the same keyframes, but space them out differently so that he ends up swimming at a different pace. It doesn't really matter what order you do those two steps, either adding the loop and expression or copying and pasting keyframes, but I'm going to do the copying and pasting keyframes first. First what I want to do is actually make them a little bit closer together to make the fish swim faster. I'm going to have the keyframes just 10 frames apart instead of 20. I'll just drag these closer together. Then, I'm going to have them start to slow down. The next set of key frames is going to start at 310. I need to copy and paste all of these keyframes, but if I were to just select them all and hit Command C, Command V, you might know this already but, it's going to copy and paste all of your layers, not just the keyframes like you want it to. Why I have a plug-in for this which is called Motion 3. I can just select all of the keyframes, place my playhead where I want to paste them and hit Clone. Now, Motion 3 is a plug-in that you have to pay for and I'll have the link below this video. I'm not going to get any money from telling you this, but I just find it really helpful, so if you think you would find it helpful, then go ahead and check that out. If you don't have a plug-in for copying and pasting keyframes, you're just going to have to select your keyframes layer by layer and hit copy and then paste. You just can't do multiple layers at the same time. One thing that we need to fix right away is that if you were to look at these keyframes, let's just look at the fin in the graph editor, you'll notice that we have one cycle of the fin and then stillness and then one cycle of the fin, and that's not what we want. But that happened because we copied and pasted the same exact keyframes, but these keyframes are a cycle. They go from zero to a rotated state back to zero. What we really needed to do was just copy the second set of key frames like these. One way that I can just fix this is just to take all of these keyframes and smush them in to these keyframes because this keyframe here is zero, this one is zero, this one is zero, and this one is zero, and so are these four. It's not going to change any of the animation, but now if I look at my graph editor, I've got two continuous strokes of the fin. Now, if I were to just drag all of these keyframes over to 310, so 20 frames apart. Then he's going to slow down nicely. Then I want to drag these ones to 20 frames or let's do a little bit more than 20 frames to make him slow down a little bit more. We need to copy and paste some keyframes for the body and tail that go with these thin keyframes. We need to copy these ones because remember we're trying to make this go every other. I'm going to want to paste these keyframes on the tail and body two frames after the fin key frames, because that's how they're all staggered. I'll just hit Clone and then shrink down the timeline. I'm going to do another clone of these keyframes because remember it's every other here at 520. Then, a last clone here. That's going to be these keyframes going there. Now, let's play this back. He swims fast and then he slows down. Now, let's add the loop in expression to repeat these keyframes in this section right here, but I don't want to loop all of these key frames. This is where that modifier number is going to come in really handy. If you remember that from the loop expressions lesson, I'm going to use the loop in but with the cycle and a modifier. For the fin, let just go in and do loopin. Then I'm going be using cycle because remember that the fin goes out and then back in, but the easing between those two key frames are different. That's why we're using cycle. Then make sure you go to the right of the quote and then use a comma, and then that's where we're going to put in the modifier. Let's figure out what number we need for the modifier. It's going to automatically do the first key frame and then the one, two after that is what we want. I'm going to use two for the modifier. Now, that's going to repeat these three keyframes in this section. I'm going to want to do the same thing with the z rotation. I'll just copy that and paste it and the same thing on this bottom fin. Then for the body and tail, we're just going back and forth between two key frames. I'm going to use the loopin with pingpong, loopin and then pingpong and then arrow over and then make sure you do the comma. Then to figure out the modifier, we're going to do the first one, it's automatic and then the one after that and that'll just repeat these two key frames. The modifier is one, and that's going to be the same thing on the tail. Now, let's play this back and see what it looks like. That looks pretty good but if you notice, when he gets to the end, the rotations at the last frame and the first frame are not the same. If I position my playhead at the beginning, you can look at the rotation numbers and it'll tell you what your rotation values are at the start. What I want to do as an easy fix to this is just make a keyframe at the very end that uses those same rotation numbers. Everything is zero except for the tail and body. I'm just going to go to eight seconds and set a keyframe. Actually, these keyframes are zero, I'll just move these ones over. Then this keyframe is not actually five at the beginning, it's 4.4. I'm just going to type in 4.4 here. Then this keyframe slide it over a little, is negative 10.2 at the beginning, so I'll just type in negative 10.2 here. Then these ones are going to be zero. The keyframe is already zero, so I can just slide those over. Now, the rotations at the last frame and the first frame are the same. Now, if I play this through it should loop seamlessly. He gets like a joy at the beginning, which is actually pretty natural for fish if you watch some reference of them swimming. I like how that's turned out. One more thing to do is to adjust that wave warp on the bottom fin piece. Right now, the wave warp which is moving consistently but let's keyframe the wave speed. Starting at zero, it's going to be traveling at a speed of one. Then at two seconds, we're going to just move this 2.5 to slow it down. It's going to set these whole keyframes, but the animation of the wave will still animate smoothly. This just looks a lot better because it's more consistent with the speed of the fish. 17. Loop Compositions Seaweed: Now we're ready to start putting all the pieces together in our underwater scene and to do that it's going to involve looping entire compositions. If you put it back what we have now with our seaweed, you'll notice that all of the seaweed is swaying at the exact same time. But we can make this look a little bit more natural by sliding the seaweed compositions around so that they're not all in the same position at the same time. To do that, we're going to need to loop the entire composition. I'm just going to start with this seaweed right here. Seaweed vine 1, it's layer 12 and I'll solo that so we can focus on it. To make this composition looping, I'm going to add a time remap. To do that, I'm going to right-click on "The Layer," go up to "Time" and then "Enable Time Remapping." That's going to add the time remap property and it's also going to add a keyframe at zero frames for the time to be zero seconds and zero frames. Basically time remap is allowing you to keyframe the timing of this composition within the competition that it's in the underwater scene. You could actually adjust the time to speed it up or slow it down, by just keyframing the time remap. You'll also notice that at the end of my composition, I have a keyframe that I can't actually reach but it's set for eight seconds at eight seconds in my composition. But since this is an eight second composition, I can only reach my play ahead to 729. That's a good thing because that'll make my underwater scene loop perfectly because all of my layers have the last keyframe on eight seconds to be the same frame as the first key frame at zero, and I don't want those two key frames to be played back-to-back on at loops, because then I would have two of the same key frames in a row and that wouldn't be a perfect loop. To make the composition loop, I'm going to option click on the "Time Remap Stopwatch" and then use my LoopOut, loop expression. I don't need to type in anything in the parentheses because I just want this to be cycle and I don't need a modifier and so that's default, or I could also just type in cycle so that I know that, that was intentional to have it be cycling. Now that this composition is looping, I can slide the layer to offset the timing of it. I'm just going to slide it over, so this keyframe is about at seven. Now this seaweed is a little bit offset from the other kinds of the same seaweed. Let's also offset this seaweed over here. We're going to need to do the same thing and loop the composition. I can just copy this time remap actually and paste it onto the seaweed, to quickly just make this composition also loop and just keep in mind that it's going to paste the time remap keyframes wherever your play head is. Then I can just drag the layer to offset it. Keyframe will be at six seconds and then drag this out. Now all of these are offset, a little bit more. It's as if a wave is coming across this scene. I can do the same steps to make the antler seaweed offset and also the vine 1 seaweed that are in the back. If I play this back, my vine and antler seaweed is now all offset and it looks a little bit more natural. One thing that I'm noticing is that this seaweed, that I flipped is going the wrong way. I'm imagining that there's like a wave going across my scene, and that's what's pushing the seaweed. This one is bending the opposite direction as my other ones, which doesn't make a whole lot of sense with my wave. What I'm going to do is just also make this one loop. So I'm going to add the time remap and then LoopOut cycle. Then I'm going to drag it until it's more bending towards the left, which is more in line with the rest of the scene. We'll also need to do that with this seaweed here, because that one has also been flipped. This one is already looping, so I'm just going to drag it and make sure you only drag to the left because if you drag to the right, this is the LoopOut expression, and so there's not going to be any animation at the beginning before the time remap keyframes. I think something like that looks pretty good. There's a couple more seaweed to offset. The vine too hasn't been offset yet. This has a rotation keyframe on it, and also the wave warp effect. I think having it bend to the left first is good, but then maybe we want the wave warp to bend in the other direction. I can just go up to the "Effects Controls" and offset the phase of this. Let's just solve this. You can see what we're working with. When I adjust the phase, it's still going to loop, because really the only thing that determines whether or not it loops is the speed. I can adjust the phase to anything I want, so maybe something like that. Then I can just do the same thing on my others. This one is a little bit more in the center of the comp so the wave, if it's coming from the left will reach this one a little later. Maybe I'll just drag this composition to the left so that the rotation is a little bit offset. Maybe something like that and then just make sure to drag out the rest of the composition. This should still work perfectly because we have the loop property on the rotation and then I can go in. I think my wave warp is actually pretty good for this one, so I'm not going to adjust it. Then I'll adjust the rotation. By just sliding this layer, I'll make this maybe rotate it about like that, and then drag that out. Let's adjust the wave warp. Maybe the phase will be something like that. We can also adjust the bumpy seaweed and this vine 3 seaweed by just adjusting the phase on the wave warp effect. 18. Loop Compositions: Fish: Let's add the rest of our fish to the scene. I'm going to start with the butterflyfish. Now, I've already added the pufferfish to the scene, and he is looping automatically because he starts off screen on the right and ends off screen on the left. But if all of our fish did that, either started off screen to the right or the left, then they'd all like crossover at the same time in the middle. We would have a blank frame at the beginning and end, and so it would look like a weird fish race or something. Instead, we want to make it so that some of our fish are already on screen when this starts, so we always have fish on screen and always have fish going off screen. With this butterflyfish, the first thing that I'm going to need to do is make the composition loop and I'm going to do that the same way that I did my vine one seaweed. I'll just right click, go up to time, enable time remapping. Then option click on the stopwatch and then do loop out. You can do cycle. You don't have to because it's default. Then remember earlier in this class, I mentioned that all my compositions for the fish were actually eight seconds and one frame, one extra frame. There is a reason behind that, and so now I'm going to show you that reason. When I loop this, if I just drag out the rest of my composition, the last frame where the time remap is set, is actually nothing. The fish has disappeared. What we need to do, is take our playhead one frame to the left, where you can see the fish is now reappeared. The time is going to be eight seconds. We're going to hit this little diamond button to add a key frame for eight seconds right here, and then we can delete this key frame for eight seconds in one frame. Now this is going to loop perfectly. Before we had that missing frame, so every time it played over that, the fish would disappear for a frame, which can be really drawing and obviously we don't want that to happen. This is still going to be looping perfectly because when you loop the time remap expression, it starts again on frame 1 instead of frame 0. So I have eight seconds, which is the same as my frame 0 within this composition. We can just double check that here. Right now on frame A, narrower on frame 1, they're exactly the same. When I play this through, it's going to play frame 8 and then frame 1, and then it'll keep going. This way, I've made a perfect loop without repeating a key frame at the end of my composition and without making my fish disappear for a frame. That is why I set the composition of the fish to be eight seconds and one extra frame. Then I did that handy little trick where I set a key frame, one frame to the left for eight seconds, and then deleted the key frame for eight seconds in one frame. Now I can slide this composition around and if I extend it, I can have this fish start and stop anywhere in my scene. Anywhere I slide it, the first frame and the last frame are always going to be one frame apart, so that when I play this through, it's a loop. I have complete flexibility of how I slide this composition around. Now let's animate this fish swimming across the scene. I actually wanted to take longer than eight seconds for him to swim all the way across the scene. So to make this easier, I'm just going to temporarily make this composition longer, so I can see where I'm setting my key frames. I'll just make it like 28 seconds for now. Then I'm going to go and insert a position key frame at zero for this fish to be all the way off the screen to the left. Then I'm going to slide over to about 16 seconds, and I'll set a key frame for this fish to be all the way off the screen to the right. I can go in and adjust these handles on the motion path to make him not swim in just a straight line. But if you preview this animation, you'll notice that the fish looks a little bit weird because the fish's body isn't rotating when he moves down or up. So what we can do is right click on the fish layer, go up to transform, and then auto orient, and then just check orient along path. So then that way, he will rotate in the direction that he's moving, either up or down. So now we can go back and make our composition eight seconds again. When we preview this, you'll notice that he's only going to get to about the middle of the screen in the eight second composition. What we need to do is make a duplicate of this fish, and I'm going to use a marker to know where the fish ends up at the end of this scene. On a Mac, that keyword shortcut is control eight to set a marker. Then you can move this marker one frame to the right so that it's actually on eight seconds, and then I'm going to hit Command D to duplicate this layer. I'm going to drag it to the left, so that my marker is now on frame 0. The reason that I wanted this marker to be on eight seconds is so that I can make a perfect loop, so the fish won't be in the same spot on the screen for two frames in a row. Now, let's play this back and we have one fish, this one, our original, that's going to swim from the left to the center of the screen. Then I have another fish that's going to start in the center of this screen where our original fish left off, at the end of the composition, and he is going to swim from the center of the screen, off to the right. So now we do have two fish, but that's okay because I want a lot of fish in my scene. This way it makes it so that it's looping perfectly. This concept of making one fish end up where the other fish left off is an important concept to understand. So let me just demonstrate it one more time using the angelfish. I'm going to drag the angelfish onto my composition, and then I'm going to need to make it loop. I'll go up to time, enabled time remapping. Option click, then loop out cycle. Then I'm going to just slide this over so I can reach that last key frame. I'm going to go one frame before that, set a key frame for eight seconds, and then delete this key frame for eight seconds in one frame, and then I can extend this out. Let's just make our competition longer for just a second. Now I'm going to set a position key frame for the angelfish to be all the way off the screen to the left at zero seconds. Let's go at like 12 seconds. I'm going to set another position key frame for the fish to be all the way off the screen to the right. I'm going to adjust the handle so this fish doesn't just swim straight across. Something like that maybe. I'm going to right click on the layer, go to transform Auto-Orient so that it looks a little bit more natural when the fish is swimming. Now, I'm going to bring my composition back to just eight seconds. So I want this angelfish to not start off screen, so I'm just going to drag the layer maybe to about here. Then I'm going to see where the angelfish ends up at the end of my composition. It's not quite off the screen, so what I'm going to do is hit Control eight to make a marker, and I'm just going to drag the marker one frame over to the right so that it's on eight seconds. Then I'm going to duplicate this composition and drag it back to the left, so that this marker is on zero. Now I have a fish that's going to swim from here over to here, that's this first layer. Then I have a fish that's going to swim off, so really he's not visible for much time at all. He just going from here and then all the way off. But this is not going to be a looping composition yet. As you can see if this looped, this fish would just pop in. That's because he's already starting on screen, so we need to do is make another fish that animates from off screen left to this position. On my original angelfish layer, I'm going to set a marker for zero seconds. Then I'm going to duplicate this competition again, and now I'm going to drag this composition, so that this marker is at eight seconds. Make sure you push it one frame paths where your playhead can reach, and now let's put this back. I'm just going to solo angelfish so we can focus on them. That's looking good. I like to think of this as the mark duplicate and slide technique. If you have a fish that starts on screen, and doesn't make it quite all the way off screen by the end of the composition, then you're going to have to mark the end of the composition and bring that marker in a duplicated calm to the beginning, and then you're also going to need to mark the beginning of the composition and duplicate it, then bring that marker to the end of the composition. So you end up having three fish to do the job of like one fish, but you will see multiple fish on screen at one time, which works out really well for this underwater scene anyways. Now this angelfish is actually the one that swims really consistently, and I actually want to use my angelfish that doesn't swim so consistently. I want to use this sporadic one. I'm actually just going to delete these three angelfish for now. I just wanted to demonstrate again how to use that mark, duplicate, and slide technique. 19. Loop CompositionsL Sporadic Fish: You can add your other fish to the scene in the exact same way that we added the butterfly fish to the scene, but what about the fish that don't swim consistently? We need to specifically animate the position of those fish animating across the screen so that it lines up with how fast their fins are flapping. I'm going to do that with the angel fish, so I'll just bring that onto my composition, and the first thing I need to do is make this composition loop, and then I'm just going to drag it to the left so I can reach this keyframe, and then I want a keyframe at eight seconds, then I'm going to delete the one at 801.Now I need to make my composition longer so that I can see all the keyframes that I'm going to set on this fish. Let's go to the beginning, and I'll just have the prime zero of this composition start at zero. Now I am going to set up position keyframe for the fish to be all the way off screen to the left at zero frame, and I'm going to make this a nice number negative 150, and then I'm going to eight seconds, and I'm going to make the fish go over to about three-quarters of my composition. Let's do like 1,300. Then I'm going to go to 16 seconds, and I'm going to make the fish move that same distance and it moved between these two key frames. That's going to be 1,300 plus another 1,300 plus the 150. That was negative at the first keyframe. If I look at my graph editor for these keyframes, you can see if you go to the speed graph that the line is just flat across. We know that these are all going the same speed. Let me explain why this is going to make sense. Now I'm going to select all my keyframes, right-click, "Keyframe Assistant, Easy Ease In". Now if I go into my graph editor, I can see that the speed is going to be quick on the position of this fish in the beginning, and then it's going to slow down. It's going to slow all the way to a stop here because my speed reaches zero pixels per second. We just saw this fish so we can focus on it. This is close to what I want. I want the fish to move quickly, and then slow down because if you remember from this composition, these keyframes are close together, he's moving quickly here, and then he slows down towards the end. That's the reason why I added a keyframe in the center and then I did easy ease because that gets me closest to the fast, slow movement that I want. But now I'm going to need to go in and adjust the graph editor. I'm just going to select all of these keyframes and bring it up from zero because I don't want him to come to a complete stop. I'll just drag these up, and let's see if that looks better. Does look better. He shoots off quickly here at the second time through of his animation where he starts looping, so I'm going to click off to the side to unselect all my keyframes, and then to make that more subtle, I'm just going to bring this point down, and so now it will increase more gradually. I also want the fish be going a little bit slower at about this point, so I can just adjust this handle, probably want the same on this one.You're just going to need to play around in your graph editor adjusting the handles to get the fish to move with the timing that you want. Let's play this back and see how it looks. That's not bad so I'll just stick with that for now. I'm going to close on my graph editor.This fish is swimming very straight, so I'm just going in and adjust the handles on the motion path. I also need to right-click, go to transform, auto-orient and make sure that my fish is orienting along the path, and then what I'm going to do is go back to an eight second composition. At eight seconds this fish is only making it to here in the composition. I'm going to set a marker on my layer by hitting control eight, and then I just want to slide the marker one frame over so it's at eight second,then I can hit command D to duplicate the layer. I'm going to take the duplicate and move the marker to zero frames. Now I have a fish that's going to move from the left to about three quarters of the way across the composition, and then another fish that's going to swim from three-quarters of the way across the composition off the screen. Let's play this back. That's looking pretty good and my fischer looping. If you want, you can even take some of the fish and move them behind some of the seaweed layer so that they swim in between the seaweed. If you want to adjust position keyframes that are already set, so say I wanted to take these butterfly fish and move them down into my seaweed, I'm going to select both fish, hit P on the keyboard, and then select both positions, and make sure that my play head is over one of the position keyframes. It doesn't really matter which one. Then I'm going to drag the y-value for whichever keyframe your hovered over, that layer down into the place that you want it, and then both fish should have moved. Now you can take your layers within your timeline, just move them below some seaweed. Maybe that's a little fa. Maybe something like that. Let's play back what we have. Now you have everything that you need to know if you want to add more fish to using, to use the same technique that I showed you in this video. 20. Add Final Details: This video is totally optional if you want to add some extra details to your scene. We have this puffer fish that's opening his mouth. What I'm going to do is add some bubbles coming out of his mouth. Now I've already animated this for you in this bubble composition. Just these five bubbles that trail up after they appear. I'm going to go back into my underwater scene and then I'm going to drag my bubble so that the little cross here at the center of my mouse is right near the puffer fish mouth. I'm also going to at the start of this composition to start right here where my play head is where his mouth is open, and then those bubbles are going to trail up and he also opens his mouth again right about there. I'm going to take the bubbles comp again and drag it about there and make sure it starts where my play head is. Now these bubbles are not quite finished animating off by the time that the composition ends, so when we start back at zero, the bubbles are just going to disappear. What we need to do is do that little marking technique again. I'll hit "Control A" to make a marker. Then move the marker over one frame to eight seconds, and then duplicate this composition and drag it over so that the marker is at zero. Now this is going to make a perfect loop. I've also included these other bubbles if you want to have them coming out of the seaweed or something. If you want to add fish, the background of your scene like I've done here, I'll show you how to do that now. We can actually just duplicate some of the fish that we have here. I'm going to select both of my butterfly fish, and I'm just going to hit "Command D" to duplicate them and then I'm going to drag them below the other butterfly fish and then I'm going to take these compositions and just slide them to the left on my timeline. I'm also going to hit S on the keyboard to ramp the scale property and just scale these down a little bit, so now I have like a baby butterfly fish. I also want to color these darker so that they just look like they're in the background. I'm going to go over to my Effects and Presets and look for fill and then I'm going to take this Fill property and drag it onto one of my small fish. Then for the color, I'll just sample the ocean floor in the back for that fish and I can just copy the fill effect and paste it onto the other fish. I also want to move these behind all of my correlate seaweed. I'll just drag them all the way down to here and they're hard to see back there. I want to raise them up a little bit. I'm just going to hit P on my keyboard to bring up the position and I'll find one of these position keyframes so that I can put my play head over it and then I'm just going to select both positions. On the layer that I have, the keyframe that my play head is on, I'm going to drag the y position, so it moves these fish up. Something like that. Now another thing to note is that because we just duplicated our front fish to make these background fish is that they're position keyframes are the same and they're going to have the same motion path. They're going to be like going up and then down like that. But we did offset the timing of them so that'll add a little bit of variation. But if you didn't want them to have the same motion path, the easiest way is probably just going to be to drag in a new fish from your project panel and then do all the steps to color it, to duplicate the composition, and to make it swim across the screen, and that way you can set a different motion path and that I'll just add a little bit more variety to your scene. One last thing is that we just need to check to make sure that these guys are looping. I'm just going to slid them and play this through. This fish just popped in, so these aren't looping and that's because we slid these around, so we're going to need one more fish that goes from off-screen to this position. I'll just hit "Command 8" to make a marker on this layer, "Command D" to duplicate and then slide this duplicated layer so that the marker is on eight seconds, and now we should have a perfect loop. Now if you want to, you can add any kind of background fish to your scene. 21. Animate School of Fish: The artistic efficient display, we have a school of tiny fish that you can add to your scene. We need to make the tail and fin of our tiny official loop by using the Loop Out ping-pong loop expression. I'll copy this and use the same thing on the body, that's looking fine. Let's go into our school. You'll see that I've key framed the position of these fish so that they have a little bit more variation as they're swimming. But how it is now all the fish are synchronized in their strokes with their tails. I'm just going to loop these compositions so that I can slide them around to offset some of the fish. I'll select one of the fish. Right-click, go up to time, enable time remapping, then option click the stopwatch and use the loop out and cycle loop expression. I can drag this one to offset a little bit in which you extend the comp. But I want the position key-frames to remain in the same spot that they were. I'll drag them back into place. Now, this fish is going to be swimming exactly the same. His tail is pointing this way now, whereas everyone else is pointing this way. We can do that with a few of the other fish. You don't have to offset every single fish. But if you do it far enough, it'll look like they're all a little bit off pace, which will look a little bit more realistic. Remember you can quickly copy this loop expression by going up to edit, copy expression only, and then just paste it on some of the fish. Once you've offset enough of the fish that they look like they have enough variety to you, then you can add this school of fish composition to your underwater scene. First, let's drag the tiny fish school into our scene. We're going to need to scale that down. Maybe like that, then let's make this loop. Because this tiny fish school is a composition with a bunch of other compositions in it and this composition is just eight seconds, we don't need to do that trick where we make a new key-frame for eight seconds and delete the one that is for 8:01, so what we can do is just go right into setting the position key frame. I'll set a position key frame for these fish to be all the way off the screen to the left at zero seconds. Then, let's make them take a little bit longer than eight seconds to get all the way across. Let's make our composition longer for a second. We can see more of our timeline and we'll make them take around 14 seconds to get all the way across. I'll drag them across. Make sure they're all the way off the screen and then we can go back, set our composition to eight seconds again. I'm going to slide the layer to the left because I want these fish to start maybe right here in a nice open empty space and then, let's see where they reach at the end of the composition. They're not quite all the way off, so we need to set our marker, move it over to eight seconds. Duplicate this composition, slide the duplicate over so that the marker starts at zero. Since these fish are starting on screen, we also need to set a marker on zero seconds and make another duplicate and slide it so that this marker is at eight seconds. I want my school of fish to be behind all my other fish, so I'll just select them and bring them below the other fish and now we have added a school of fish to our scene. 22. Rendering a Video: When you're finished with your scene, decide what file format you're going to want to render your animation out as. If you need help deciding, go back to the video about file formats. The first way to export your file is as an MOV file. I'm going to go up to Composition, Add to Render Queue, and then make sure you have Apple ProRes 422 here. You can choose that with the format options and this is only going to be applicable if you're on a Mac. Then hit "Okay" and then output to, you can choose where on your computer to save it and then hit "Save" and then hit "Render." Then you can navigate to where you saved it on your computer, and then you can open it up, which if you're on a Mac, it'll open up by default in QuickTime and if you want to see this playing back as a loop, then go to View and then Loop, and then hit "Play." You may want to render out your file as a.MP4 because that's more universally accepted and it's also a smaller file format. I'd suggest rendering out an MOV file first and then dropping the MOV file into Media Encoder, rather than going from After Effects and going Composition, add to Media Encoder straight away and I'll show you why in just a second. Once you drop your MOV file into Media Encoder, make sure that you have H.264 here. If you don't, just click on it and make sure to choose it from this drop down and then hit "Okay" and hit the play button to render. I did a little experiment just to show you. This is my MOV and this has definitely the most vivid bright colors. This is my MP4 that I rendered out through Adobe Media Encoder straight from After Effects and this is an MP4 that I rendered out through Adobe Media Encoder by dropping this MOV file into Media Encoder. This one looks a lot better by dropping the MOV file into Media Encoder than this one does. I would recommend doing that, it's one extra step, but to me it looks a lot better. 23. Rendering a GIF: Now let's look at how you can export a GIF. I like to use a plugin called GifGun to render out my GIFs, because I render a lot of GIFs and this saves me a lot of time. This is a paid plugin and I'm not going to get paid to tell you about it, but I find it helpful so I wanted to let you know if you think it would be useful to you. If you don't have GifGun, you still have two different options on how you can export a GIF. The first one is to go up to composition, add to Media Encoder Queue. But just like MP4 files, I found that if you export your MOV file first and then just drop your MOV file into Media Encoder. It's better to drop the MOV rather than the MP4 file into Media Encoder because the MOV is higher quality. Then from here, you want to change the format to Animated GIF and then choose where you want to save this to and hit render. You can play your GIF back by just hitting the space bar. Now, this is looking a little bit choppy if you look really closely. The reason why this is, is because in Media Encoder you only have the option of exporting at 25 frames per second, and if you try to go and change it here, 30 is not an option and that's why we're using an After Effects. I didn't know this before, just now because I never use Media Encoder I always use GifGun. That would have been something that would be nice to know in the beginning, but they also don't have 15 which would be my second go to, so I don't know why. But you could go with 20 or 25 or even 10 if you wanted to be really cartoony. If you don't want to use Media Encoder, there's another option. You can also export GIFs through Photoshop. If you go up to composition, add to Render Queue, then you want to change the output module to PNG Sequence and then hit Okay, and this is going to export a folder of PNG images. Just choose where you want to save that folder and then hit Render. Then in Photoshop, you're going to go to open and then open up the folder where your images have been saved and then select the first image and then check image sequence and hit Open. It's going to ask you what frame rate you want. I use 30 frames, so I'm going to keep this at 30 frames but change it if you didn't use 30 frames and then hit Okay. From here you're going to go up to File Export, Save for Web. This might take a second to open up. Then once this opens, you can see how many colors are in your scene, which if you remember from earlier in the class that determines how big your GIF is going to be. This is automatically setting to the maximum number of colors and it's a really big GIF, 27 megabytes. I never really intended for this file to be a GIF. I was thinking that it would be saved as an MOV or MP4, so I didn't plan accordingly to make this a nice sized GIF. But also demonstrate how you can export a GIF through Photoshop with this GIF. You can also choose under Looping options to either loop this once or forever. Once if you upload this to a website will just play when the website loads and then it'll stop playing after it plays one time through or forever will play automatically and keep looping over and over forever. If you need to make your GIF smaller, you can adjust the image sizes here or with the percentage and then to export your GIF, you're just going to hit Save, and you can name it and choose where you want to save it. It might take a second to save it and I've had in the past issues where I've made GIFs that are way too big to save in Photoshop and they just don't work. Make sure that you're following all the best practices so that your GIFs aren't too big. I've put together a little comparison here. This is a GIF that I exported directly from After Effects into Media Encoder. For this one, I exported an MOV file first and then put the MOV into Media Encoder. For this one, I went through Photoshop and for this one I used GifGun. 24. Wrap-Up: Congrats on making it to the end of this class. Don't forget to upload your class project. In the projects and resources tab below this video, you can post your project as a GIF using the Image button. Or if your animated scene is a bit too complex to work well as a GIF, you can post it to YouTube or Vimeo and paste the link here. Since it won't play as a loop this way, you may want to render off your scene playing through a few time so we can tell that it loops. If there was anything that you struggled with or one specific feedback on, add a note to your class project to let me know. That's it. Thanks so much for watching. I hope you had fun animating a looping scene and that you have new techniques to use in future projects. Click on my name to go to my profile page and check out the other classes that I'm teaching. Make sure you're following me on Skillshare, so you get notified when I have a new class. You can also find links to follow me on social media, and if you post your project to Instagram, be sure to tag me @explainimated. Until next time, happy animating.