Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to time remap layer using scripting?

Participant ,
Dec 18, 2018 Dec 18, 2018

I have a AVLayer that is 6s long. I'd like to slow down the first 2 seconds, speed up the 2-4s part and then again slow down the final 2 seconds.

I am totally lost when it comes to scripting keyframes.. I am even more lost now, because there is no "move" functionality when it comes to keyframes. Has anyone tried using time remap with scripting? I'd love to see some examples.

This is my starting code:

var layer = containerComp.layers[layerIndex];

layer.timeRemapEnabled = true; // sets 2 keyframes at start and end of the layer

TOPICS
Scripting
4.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Dec 20, 2018 Dec 20, 2018

Hey!

This is how I'd go about doing it--

(function () {

    app.beginUndoGroup("Time Remap Layer");

    var comp = app.project.activeItem;

    var layer = comp.layer(1);

    

    layer.timeRemapEnabled = true;

    var timeRemapProp = layer.property("ADBE Time Remapping");

    var times = [0, 2, 4, 6];

    var values = [0, 2, 4, 6];

    timeRemapProp.setValuesAtTimes(times, values);

    app.endUndoGroup();

})();

The key parts are `var times = []; var values = [];`. This is where you'd list where you want Time

...
Translate
Contributor ,
Dec 20, 2018 Dec 20, 2018
LATEST

Hey!

This is how I'd go about doing it--

(function () {

    app.beginUndoGroup("Time Remap Layer");

    var comp = app.project.activeItem;

    var layer = comp.layer(1);

    

    layer.timeRemapEnabled = true;

    var timeRemapProp = layer.property("ADBE Time Remapping");

    var times = [0, 2, 4, 6];

    var values = [0, 2, 4, 6];

    timeRemapProp.setValuesAtTimes(times, values);

    app.endUndoGroup();

})();

The key parts are `var times = []; var values = [];`. This is where you'd list where you want Time Remap keys to go, and the values you want them to have.

The values I have there aren't going to do much-- it'll add a key at 0 with time 0, a key at 2 with time 2, 4 with 4, 6 with 6.

For your purposes, it depends on how much you want to speed up / slow down things. As you seem to be doing this by eye, the values are really up to you.

Something like this would slow down the first 2 seconds of animation (stretch 0-2 to 0-2.5), speed up the middle (squish 2-4 to 2.5-3.5), then slow down the last two (stretch 4-6 to 3.5-6).

    var times = [0, 2.5, 3.5, 6];

    var values = [0, 2, 4, 6];

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines