Here’s an update:
speedRampLength = 2; // create a speedRamp over 2 seconds
speedRampSkip= 12; // at the end of the 2sec speedramp, 12 seconds have been skipped.
speedRampTension = 80; // how much easeOut (0.1-100)
comp = app.project.activeItem;
var myLayer = comp.layer(1);
duration = myLayer.outPoint-myLayer.inPoint;
// sanity checks
speedRampSkip = Math.min(speedRampSkip, duration);
speedRampLength = Math.min(speedRampLength, duration-speedRampLength);
myLayer.timeRemapEnabled = true;
var timeRemapProp = myLayer.property("ADBE Time Remapping");
// remove lastKeyframe
timeRemapProp.removeKey(2)
// add new keyframes:
timeRemapProp.setValuesAtTimes([
myLayer.inPoint+ (duration - speedRampSkip)/2,
myLayer.inPoint+ (duration - speedRampSkip)/2 + speedRampLength,
myLayer.inPoint+ (duration - speedRampSkip + speedRampLength)
], [
(duration - speedRampSkip)/2,
(duration - speedRampSkip)/2 + speedRampSkip,
duration
])
myLayer.outPoint = myLayer.inPoint+ (duration - speedRampSkip + speedRampLength);
var ease = new KeyframeEase(1, speedRampTension);
var noEase = new KeyframeEase(1, 0.1);
timeRemapProp.setTemporalEaseAtKey(2,[noEase],[ease]);
timeRemapProp.setTemporalEaseAtKey(3,[ease],[noEase]);