5 Replies Latest reply on Feb 7, 2018 8:31 AM by stevelewisza

    Invert time remapping?


      Hi, i have a composition with time remapping applied to it via an expression and key-framed slider controlling the percentage playback speed.


      Inside the time remapped composition there is one effect property i don't want to be effected by the time remap. Is it possible to somehow invert the time remapping of this effect so it appears unchanged in the parent composition?


      I think i have got close but i still cant figure it out:


      -Main Comp, example Time: 0:00:14:18


                 - Parent comp Time: 0:00:14:20, remapped time at this point (can be before and after by a few frames)


                          - Nested comp  Effect property expression:


                          var counteractTimeDisplacement = time - (((comp("Main Comp").layer("FrameDifference").timeRemap - 1)));

                           etcEtcEffectPropertyValue = somethingReferenced.valueAtTime(counteractTimeDisplacement);

                - FrameDifference Composition (Simply shows the frame difference in time)

                     Time Remapped Time: 0:00:01:02 // Added 1 second to allow negative values when time remapping is minus, maybe this should not be a timeRemap property but i dont know how to use Time values on a null object.

                     - Time remap expression:

                    (comp("Main Comp").layer("Parent comp").timeRemap - time) + 1


      Above doesn't work, and looks out of sync. I realised the FrameDifference composition is also indirectly effected by the time remapping because the nested composition is accessing it and its remapped, so i tried for the FrameDifference composition:


                - FrameDifference Composition

                    - Time remap expression:

                     (comp("Main").layer("Parent comp").timeRemap.valueAtTime(comp("Main Comp").layer("Parent comp").timeRemap) - comp("Main Comp").layer("Parent comp").timeRemap) + 1


      Its still not syncing, can anyone who understands remapping / time better than me please help i can't see where im going wrong. Again i cant take out the effect inside the remapped comp and use it separately as this will cause other problems.


      Thanks for reading

        • 1. Re: Invert time remapping?
          Rick Gerard Adobe Community Professional & MVP

          You are making this way too difficult. If you have one layer or element that you do not want to be effected by time remapping then put that element in another comp. Anything else is just a waste of time.


          Changing the speed of playback over time can be very complicated. The easiest way to understand what you are doing is to look at the graph editor. You need a lot more complex expression to be able to speed up and slow down playback without making time reverse. Please check out motionipt.com where Dan Ebberts can show you how to do the ramp up and ramp down playback speed thing.

          • 2. Re: Invert time remapping?
            bunion4 Level 1

            Thanks for the information, i am using this expression https://www.reddit.com/r/AfterEffects/comments/1lws5j/control_playback_speed_with_a_slider / to control the playback speed which i am not having a reversing issue with, but the link will still probably prove useful as i need to make separate changes to it anyway.

            I accept my approach to the nesting is probably not the right way to go, but i am new to AE and i would have structured the project differently had i for-seen this problem. If anyone can still suggest a way to invert the effect of the existing time remapping that would still be an easier solution so i would be grateful for any ideas, otherwise i will move things around as you suggested.

            • 3. Re: Invert time remapping?
              Rick Gerard Adobe Community Professional & MVP

              That's not a good solution. There is way more inaccurate information on the web about how to do things in AE than there is accurate information. You need to vet your sources.


              Try reading this article: Expression Speed and Frequency Control


              Your expression is way too simple and doesn't allow for speedup and slow down with any degree of predictability.

              1 person found this helpful
              • 4. Re: Invert time remapping?
                bunion4 Level 1

                Thanks again

                • 5. Re: Invert time remapping?
                  stevelewisza Level 1

                  If anyone's interested, I've been working on a script where I needed to find a way to invert time remapping from within the time remapped comp and I figured out the necessary formula, although I haven't managed to figure out how to make it possible through expressions alone (maybe someone else can figure that one out?)


                  The equation itself is actually fairly basic, I'm using a for loop to place a keyframe for every frame onto the time remap property of the nested layer that we want to cancel out the time remapping for, this is necessary if the time remapping has easing applied, but can be done on a per keyframe basis if all time remapped keyframes are linear.


                  You must first get the ratio of the time remap, then the time of each keyframe is set to parent comps keyTime divided by the ratio, then the value is set to parent comps keyValue multiplied by the ratio, the resulting generated curve cancels out it's parent comps time remapping, here's a snippet of my code that generates the keyframes:


                  for (var e = 1; e <= nestedAudioLayer.source.duration * nestedAudioLayer.source.frameRate; e++) {
                       var timeVal = e / layerToInvert.source.frameRate;
                       var valueVal = layerToInvertParent.property("Time Remap").valueAtTime(timeVal, false);
                       var remapRatio = timeVal / valueVal;
                       if (remapRatio != 0 && valueVal != 0) {
                            nestedAudioLayer.property("Time Remap").setValueAtTime(timeVal / remapRatio, valueVal * remapRatio);


                  An interesting thing to notice is that the generated curve is the same as the parent comp curve except rotated 90 degrees and flipped: