ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Inverting time remapping from within time remapped comp script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Steve Lewis
Inverting time remapping from within time remapped comp script
on May 29, 2017 at 9:44:58 am
Last Edited By Steve Lewis on May 29, 2017 at 9:48:37 am

Hi guys,

So I'm working on a script which involves a feature where a layer that's created inside a time remapped comp is time remapped to cancel out it's parent remapping, thus outside of that time remapped comp it'll play at regular speed, even though it's inside a remapped comp, it's an interesting challenge that I've made progress on but was wondering if anyone could help me figure out how to make it better.

An interesting finding is that that the keyframe curve of the nested layer that cancels out the parent comps time remapping is actually the exact same curve shape, except just rotated 90 degrees then flipped horizontally as you can see here:

parent time remap:

nested time remap (cancels out parent):

(Notice how when the curve of the parent comp gets really fast in the middle of that s-curve, to compensate for that the nest curve must get really flat etc)

At the moment my script places a keyframe on every frame, but I was wondering if anyone can think of a way to use the same number of keyframes as the parent remapping, but some how rotate and reverse the influence and speed of those curves to create the correct curve, since generating keyframes of every frame brings AE to it's knees on really long comps, causes major loading and will sometimes crash AE before finishing, it would need to involve somehow converting the influence value of the keyframe to the speed value and then reversing the keyframes.

The formula I've come up with to invert remapping is actually fairly basic, first it must get the ratio of the time remap by dividing each keyframe value with that keyframe time. The time of the new generated keyframe is then set to the containing comps keyTime divided by the ratio, then its value is set to parent comps keyValue multiplied by the ratio.

I've included the code I'm currently using to generate the invert curve.

I'm also wondering if it would even be possible to rather create an expression on the nested comps time remap to cancel out it's parent using a similar formula along with valueAtTime etc. so it calculates continuously?

Any additional thoughts or ideas here would be much appreciated!


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

Return to posts index

Santi Agustí
Re: Inverting time remapping from within time remapped comp script
on Oct 16, 2019 at 2:01:55 am

did you make any new approach on that idea? or finished that script? I'd love to see how that expression for cancelling out its parent's time remap could look like, specially being applied directly into a prop like position?

Something like: a comp have some animated layers and a circle layer with keyframed X position going from left to right. Then on the parent comp we apply time remap with several keys, so we can apply that magic expression to the circle layer pos to cancel the remap and we see the circle keep its original speed.

So it would be like having the inverse of this expression on pos:
t =comp("retime").layer(;

but I guess that won't be easy...

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved