ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# How to control a layer in-point and out-point animation with time remapping slider

FAQ   •   VIEW ALL
 How to control a layer in-point and out-point animation with time remapping slider on Aug 18, 2017 at 10:13:21 am

Hello everyone !

Here's my situation :

I have a precomposed animation for a layer (incoming and outgoing are different animations) and i'd like to use time-remapping to set the incoming animation on the layer in-point and the outgoing animation on the layer out-point.

For example, here's what I'd like to do :
- at the layer in-point, a 35 frames animation starts
- 10 frames before the layer out-point, the outgoing animation starts

I've seen many expressions about time-remapping with a slider, but no one really matches my needs.

Thank you all for your help.

 Re: How to control a layer in-point and out-point animation with time remapping slideron Aug 19, 2017 at 1:28:19 pm

I've find this nice expression from Kevin Camp, but it's designed to read the animation forward and backward.

```t = thisComp.frameDuration*15; if (time-inPoint <= t) time-inPoint; else if (time >= outPoint-t) outPoint-time; else t;```

In my case I'd like almost the same, except the layer's outpoint (minus the duration of the outgoing animation) plays forward.
Not sure I make myself clear :))

 Re: How to control a layer in-point and out-point animation with time remapping slideron Aug 19, 2017 at 4:53:22 pm

And I've found a few minutes ago this expression that almost perfectly does what I want :

```//On the time remap property L = thisLayer; t = time; animLength = 10; animLength *= thisComp.frameDuration; LDur = L.outPoint-L.inPoint; MidDur = LDur - animLength*2; if( t>=L.inPoint && t<= L.inPoint+animLength) {t-L.inPoint} else if( t>L.inPoint+animLength && t<L.outPoint-animLength) {animLength + (t-L.inPoint+animLength)/MidDur)*(L.source.duration-animLength*2)} else if(t>=L.outPoint-animLength && t<=L.outPoint) {t-(L.outPoint-animLength)} else 0;```

It plays the first 10 frames of the animation at the layer's inpoint, then stretches the in-between frames, and plays the last part of the animation 10 frames before the layer's outpoint.

I can use this expression, but I would like to know if it could be improved in order to freeze the animation in the middle.

Thanks !

 Re: How to control a layer in-point and out-point animation with time remapping slideron Sep 5, 2017 at 7:47:11 am

Hi Sebastien,

I am getting an error on line 9 if I try this expression (Expected: ;.). Do you know what is going wrong?

Thanks,
Roy

```L = thisLayer; Src = L.source; SrcDur = Src.duration; LDur = L.outPoint-L.inPoint; SrcInDur = framesToTime(28); //the duration of the in animation SrcOutDur = framesToTime(34); //the duration of the out animation SrcLoopDur = SrcDur-SrcInDur-SrcOutDur; if(time &lt; L.inPoint+ SrcInDur) { tSampleT = time-L.inPoint; } else if(time > L.outPoint-SrcOutDur) { LOutElapsed = time - (L.outPoint-SrcOutDur); tSampleT = SrcDur-SrcOutDur + LOutElapsed; } else { tSampleT = SrcInDur+Src.frameDuration; }```