to make a perfect exact loop do this:
1. create the TR keyframes
2. go to one frame before the last frame and create a keyframe
3. copy the first keyframe over the original last keyframe.
4. add this expression loopOut()
Do what Roei said. You are over complicating things. I don't know where you got the idea you needed to reset the last keyframe to zero but it sounds like it was from somebody that did not understand AE. The frame rate of the comp has nothing to do with anything. Time remapping is based on time and loopOut() and the first frame of your loop as a keyframe and the last frame of your loop are all you need. The confusion happens because Time Remapping sets the last keyframe after the last frame has played back so you end up seeing it.
Using the keyboard:
- Alt/Option + Ctrl/Cmnd + t to enable time remapping and extend the layer's out point to the length of the current comp.
- k to move to the last time remapping keyframe
- Ctrl/Cmnd + left arrow to move back one frame
- Click the Add Remove Keyframe diamond to insert a new keyframe at the start of the last frame
- press k to move to the last keyframe
- Click the Add Remove Keyframe diamond to remove the last keyframe
- Alt/Option + click the Time Remapping stopwatch to add an expression
- type loopOut() and click anywhere to enable the expression
If your looping comp is exactly the right length when you apply time remapping to the comp your loop will be perfect.
Rick, your suggestion and mine are different.
To make a perfect loop back to back you need to replace the original last keyframe with the first keyframe and not delete it as explained in my post. You are left with 3 keyframes in total.
This is different than the classic method you are suggesting which will create a loop over a loop and will actually remove the first keyframe on every loop.
Right so I did exactly as you said and it works perfectly right until the very end. I noticed something odd and I'm unsure how to explain it so I'll use images.
Result of 6 sec comp after doing what you said:
Then I noticed that at the very end of my main comp it's at this time/frame:
Shouldn't it be at 0;00;00;00? I'm assuming this is why it's not looping correctly? I thought that a 6 second comp would go into 174 seconds or am I looking at this the complete wrong way? Sorry to be a pain, just very confused. Thanks for both of your help.
then you want a loop over a loop and not a loop after a loop, and you should delete the last keyframe (as Rick suggested) and you will be fine.
this is loop over a loop (loopOut with 2 keyframes):
1st loop: 00:00-06:00 - precomp ranging from 00:00-06:00
2nd loop: 06:01-12:00 - precomp ranging from 00:01-06:00
3rd loop: 12:01-18:00 - precomp ranging from 00:01-06:00
as you can see, you are always skipping the first frame of your precomp.
this is loop after a loop (loopOut with 3 keyframes):
1st loop: 00:00-06:00 - precomp ranging from 00:00-06:00
2nd loop: 06:01-12:01 - precomp ranging from 00:00-06:00
3rd loop: 12:02-18:02 - precomp ranging from 00:00-06:00
this is as if you did this, all your frames in the precomp get played, but there is a shift in time because you are playing a sequence and right after playing another - there is a frame offset in the playback.
Roei, you are making things too complicated. A long time ago a perfect loop required 3 keyframes but it has not for a very long time.
If the first and last frame of an animation is exactly the same then loopOut() will work perfectly with just 2 keyframes. Whether it is time remapping or simple animation, there is no longer the need for fiddling around with a third keyframe.
For example: Animate the hand of a clock by setting a keyframe at 0 - 0º on frame zero and 1 - 0º on frame 30 and add a loopOut() expression and the clock hand will rotate perfectly every time. Trim the layer at frame 30, pre-compose, time remap, go to the last keyframe and the clock hand will disappear, back up one frame and the clock hand will reappear. Set a new time remapping keyframe, press the K key to move to the last time remapping keyframe and delete it and add a loopOut() expression and the clock hand will animate perfectly. It works every time.
The only time you need 3 keyframes to create a perfect loop would be if the animation was set up so the action would end one frame before the cycle was complete. Say the clock hand was set up to rotate 1º per frame and the last frame was at 359º instead of 360º. Only then would you have to copy the first keyframe and paste it one frame after the first keyframe to get a perfect loop.
Maybe this will help.
Rick, Your example is not perfect for this issue since your first and last keyframe are the same. I can assure you I have varified this issue to the fullest. If you want to see where the problem is with the classic 2 Keyframe TR try this example: place a shape on the first frame and Create a KF, move it to the right at the last frame and create a KF and let it interpolate from 00:00 to 06:00. Now precomp and create a TR with the classic method. To compare, duplicate the same precomp with no TR and place duplicates back to back one instance after the other. Set it to difference if you wish. You will see the TR don't match the back to back precomp and this is because you are overlapping a frame each time. You are playing a loop overlapping another loop in 1 frame. You can see that the first frame in the second loop of the TR is 00:01- meaning you skipped 00:00. If you want a perfect loop meaning that all the frames of your precomp will be shown, you must use 3 keyframes. If you want a loop to be overlapping the previous one, you can use the classic method.
In hour example the first and last frame are not identical. You don't have a loop, you have a repeating pattern. If you want a repeating pattern where the first and last frames are not identical, then you need 3 keyframes. The copied first keyframe makes the first and last frame of the loop identical.
Let's talk about a 10 frame animation. loopOut() starts the loop at the 10th frame, not the 11th as most folks would expect. This means that the 11th frame is already one frame into the action and the action seems to jump. The loopOut() function continues to operate from 11 through 20 and the 20th frame is identical to the first frame. The second loop starts and runs to frame 29 then on frame 30, as it should be the first frame is repeated. This means the original last frame of the action is never shown. The jump shifts from the 11th frame to the 19th frame, which makes perfect sense. That is why loopOut() works perfectly if the first frame and last frame of an animation are identical and why you need a 3rd keyframe when you want a repeating pattern with different first and last frame. It is a lot easier to design a loop where the first and last frames are identical. Particles, rotation, opacity, moving gradients all work perfectly if you have identical first and last frames. Repeating patterns are a lot harder to make look seamless.
Grammatically there is a difference between a seamless loop and a repeating cycle. I man have incorrectly assumed that natashas12686874 was looking for a Loop when instead he was looking for a repeating cycle.
In hour example the first and last frame are not identical.
they are in the sense that visually they are the same - the first frame is set to 0x0 and the last is 1x0. that's why your seamless loop works because you have 2 identical keyframe as you explain yourself further in your post.
You don't have a loop, you have a repeating pattern. If you want a repeating pattern where the first and last frames are not identical, then you need 3 keyframes.
one could say they are synonyms. we can agree that these are two different kinds of loop. seamless is a good way to explain the 2 kf approach. let's settle for seamless loop (2kf) vs repeating loop (3kf)
I may have incorrectly assumed that natashas12686874 was looking for a Loop when instead he was looking for a repeating cycle.
I think Op actually meant he is looking for a seamless loop where the math adds up so at 00:02:54, the precomp would show 00:00 because it's 174 seconds which is 6 seconds x 29. I was just being picky on what a perfect loop is. now I think I should use the term repeating loop vs seamless loop to differentiate between the two ways of doing this.
If it a seamless loop (identical first and last frames identical) and the two keyframe loopOut() method works then it does not how many frames are between the first and last frames. You can change the timing of the loop using time remapping. If he has a seamless loop comp that is 4 seconds long and he wants to repeat the loop exactly 10 times in a 20-second comp then all he has to do is a little math. 10 loops in 20 seconds is one loop every 2 seconds. Grab the last TR keyframe and drag it to 2 seconds and the timing is perfect. If he has a 2 minute 27 second comp and he wants 5 loops then, to make things easy, change timecode to frames, go to the out point of the comp and count the frames (for a 29.97 fps comp that is 3527 frames), divide by 5 (705.4), move the CTI to the nearest whole frame number (705), and the loop will repeat 5 times. It does not have to be any harder than that.
Render the short animation. Then import it and use the Interpret Footage dialog to set the number of loops you require. This should be standard procedure if you want to loop something numerous times.
thanks Roland, that's a good workflow if you wish to render or the best method if you already have a render. making sure and comparing this way to my original 3 kf suggestion proves my point - they match perfectly whereas using the 2kf method will skip the first frame in the second loop and skip the last frame in all following loops and won't match the interpret footage loop feature. 3kf = perfect loop, 2kf = overlapping loop.
Thank you very much for your help. It's working perfectly now and I have learned a lot from all of the replies. It's very much appreciated.
Thank you all.