-
[HELP] Time Remap – Trying to create a Script
Hello guys! I’m trying to create a script that does this:
Step 1: Enable Time Remap of a precomp ( or all precomps selected)
The time remap automatically creates 2 keyframes, so…
Step 2: Go to the last keyframe and go back 1 frame, create new keyframe and delete the last keframe. Example: a precomp of 10 seconds (25 fps) would have a keyframe on frame 0:00 and another keframe on frame 10:00, i want to create a keyframe on frame 9:24 and delete the keyframe of 10:00. I want this to happen no matter what time duration is that precomp and no matter how fps it is, always create 1 keframe before the last one and delete that last one.
I now how to do step 1, but only works with 1 layer, i don’t know why is the “for loop” not working, and also i’m having trouble with step 2.
The code that i have right now is this:
app.beginUndoGroup("My Script");
var comp = app.project.activeItem;
var layers = comp.selectedLayers;
if(layers.length == 0){
alert("You must select a layer");
} else {
for(var i = 0; i < layers.length; i++){
layers[i].timeRemapEnabled = true;
var timeRemapProp = layers[i].property("ADBE Time Remapping");
var times = [0, //i think here goes something like "outPoint - one frame"?//];
var values = [0, //i don't now what should i write here//];
timeRemapProp.setValuesAtTimes(times, values);
}
}
app.endUndoGroup();