2 Replies Latest reply on Nov 23, 2015 5:18 AM by aryamaiy

    Loop error

    aryamaiy Level 1



      I am using Adobe After Effects CS6.


      For a project I need to repeat 3 frames to form a word, and I use the following steps:


      - Time -->Enable Time Remapping

      and than the code loop_out('cycle' ,0)


      This is a print screen of the pre-comp how the build up is from a letter:





      The problem is the following: once in the second he blacks them all - as if he puts the frames on top of each other for one frame.



      Any tips or suggestions how I could build this without the black frames?

        • 1. Re: Loop error
          Rick Gerard Adobe Community Professional & MVP

          Please don't scale down your screenshots. Just take a full resolution screenshot and drag it to the reply field in the forum and the forum will take care of everything else. It's pretty hard to tell what you are doing when all you can see is this:

          Screen Shot 2015-11-23 at 4.51.44 AM.png

          If you are getting a black frame then you are not understanding how Time Remapping and the loopOut expression works. When you enable Time Remapping on a layer that is 30 frames long you get a keyframe at frame 0 and at frame 30. The problem is that frame 30 starts after the layer has ended so there is nothing in the frame. The loop out expression repeats or loops keyframes so you must make the loop end at frame 29 where there is still picture in the layer. You can't do this with Time Remapping by dragging the keyframe to the right because the value of the keyframe is the time. Instead you have to add a new keyframe at frame 29 and delete the keyframe at frame 30. This is confusing because time starts at zero and ends after the last frame has played. This makes the last frame number of a 30 frame clip is 29 and your mind desperately wants it to be 30.


          Here is how to use time remapping to create a loop that you nest in a longer composition:

          1. Create a composition called "loop" that is long enough for one complete cycle of your animation - let's say 30 frames
          2. Create a composition called "main" that is long enough to include the entire sequence you are creating - let's say 300 frames (I am using frames instead of seconds to make things easier to understand
          3. In the "loop" comp create one complete cycle of your animation
          4. Nest the "loop" comp in the "main" comp
          5. Select the "loop" comp and go to Animation>Time>Enable Time Remapping
          6. Two keyframes will be created in the Time Remapping property of the "loop" pre comp layer
          7. Move the CTI (current time indicator) to the last out point by pressing 'o' on the keyboard (you should be at frame 29)
          8. Add a new Time Remapping keyframe
          9. Press the K key to move to the last time remapping keyframe (you should be at frame 30)
          10. Select then delete the last Time Remapping keyframe
          11. Press the Alt/Option key on the keyboard while clicking on the stopwatch to add an expression to Time Remapping
          12. Type "loopOut()" in the expression field
          13. Move the CTI to the end of the Main Comp by pressing End on the keyboard (you should be at frame 299)
          14. Select the nested "loop" comp and press Alt/Option + ] to extent the out point of the layer to the end of the composition

          There you go. You should have a perfect loop. The loop will be perfect only if the "loop" comp contains a perfect loop.


          Creating a perfect loop requires that the "loop" composition's first frame and the last frame be different. If they are the same then you will get a stutter in the animation. For example if you are rotating the hand of a clock that would rotate exactly in real time then the rotation keyframe at frame 0 would be 0º and the keyframe at 1 second would be 360º which would show up as 1 x 0 in the timeline.

          The problem is that if you create a 30 fps comp the last frame of the composition is not frame 30, it is 29. If your comp frame rate was 24 then the last frame of the comp would be 23. The easiest way to fix this problem with your loop is to move the CTI to the end of the comp, then use Ctrl/Cmnd + right arrow to move the CTI to frame 30, then grab the last keyframe and drag it to the left so line it up with the CTI and fix the loop problem.


          You could also just enter the frame number in the Time Indicator of the comp before setting the last keyframe or you could create your comp with 31 frames, set the last keyframe at 30, then trim the comp to 30 frames.


          You could also animate the rotating hand of a clock without pre-composing by creating a long comp, then on the second hand rotation property set a keyframe at the first frame of 0º then move the CTI to 1 second in the timeline and set a keyframe value of 360º, then moving back one frame and set another keyframe. This will give you the correct value without doing the math. Then you delete the keyframe and add loopOut().


          Note: the default behavior for loopOut is "cycle" so you don't need to type it unless you want to. If you want to pingpong the action then you must write out the expression fully by typing loopOut("pingpong"). Also you should know that I typed out this complete explanation because this is a common problem and most folks that are having problems with loops don't fully understand how to create them.

          • 2. Re: Loop error
            aryamaiy Level 1

            Thank you for answering! I did not know about the scaling images, I'll be sure to remember that next time.


            As for the answer, I indeed am not deep into the codes in AE, but this clears up really really much for me. Thank you very much!