There is no magic. You simply do not understand that AE operates on genuine time, not discrete frames and so do therefore expressions. Depending on what framerate you use your remapping may simply end up in a blind spot. Either way, impossible to tell based on your generic post. I would suggest you switch to the graph editor and enable the "show expression result" and I'm sure the fog will clear and you finally get it to work by placing your keyframes correctly.
You are right. I don't understand. I think I've finally found AE territory that I'm ill-equipped to comprehend. I've self-taught myself most everything I know (which is admittedly probably not that much in the grand scheme) with relatively little trouble. This is due to what I believe is a marvelously intuitive interface that Adobe has designed, and I was hoping I'd arrive at a solution the way I always have. I'm up against a deadline and had to just power through this with a bunch of duplicated layers in the pre comp, so perhaps I'll have to revisit this another time.
All this to say that I'm sure posts like mine are akin to nails scratching down chalkboards to pros like you, but I can't tell you how AMAZING and invaluable people like you are that educate the masses like myself. I've visited many a discussion on this site and seen your name, and, although I can't point to a specific one, I bet you've already helped me a time or two before. I just want to say thank you for your patience and your time.
For a basic time remapping loop out expression do this exactly:
- Pre-compose your layer or layers moving all attributes to the new composition
- Extend the length of the main composition to make room for the loop
- Go to Layer>Time>Enable Time Remapping
- use the j or k key to move to the last keyframe of time remapping
- Move back one frame and then add a new keyframe by clicking on the diamond in the Keys column for time remapping
- Delete the last keyframe
- Add the expression loopOut() to your time remapped layer.
This will always create a perfect time loop with no empty frames. It's up to you to design the animation in the pre-comp so that the movement will be seamless.
In my workflow I don't pre-compose I create a new comp the length of the animation and then just nest that comp. It saves a bunch of potential headaches that can happen. The only thing you must to is to make sure that the frame rate of your comp and your nested comp is the same.