There are a number of ways to do it, depending on how you’re doing the in/out animation. If you’re using 2 in keyframes and 2 out keyframes, you could do something like this to tie the animation to the layer’s in and out points:
if (time < (inPoint + outPoint)/2){
t1 = key(1).time;
t2 = key(2).time;
v1 = key(1).value;
v2 = key(2).value;
linear(time,inPoint,inPoint+t2-t1,v1,v2);
}else{
t3 = key(3).time;
t4 = key(4).time;
v3 = key(3).value;
v4 = key(4).value;
linear(time,outPoint-(t4-t3),outPoint,v3,v4);
}
If you’re animating in and out via expression, you’d have to alter those to incorporate the in and out point timing.