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

Automatically adjusting the length of layers and keyframes based on changing the length of a precomp

New Here ,
Mar 02, 2024 Mar 02, 2024

Copy link to clipboard

Copied

hi there! i'd like to ask if anybody has a script/expression I can use to make keyframes adjust depending on the timeline-length of a layer? meaning if I increase the out-point of a layer by two seconds, the values of "key(numKeys)" and "key(numKeys - 1) "will also only be applied to the property two seconds later? this would tie to the question if its possible to have a layer adjust its length based on the precomposition - meaning if a layer is within a precomposition and i adjust the duration of the precomposition, the layer would also adjust its length and due to a new out-point being available, the "transmission" of values from the keyframes to the property would also proportionally happen earlier or later appreciate any help:)

This one is one i've found in another forum post, but it doesnt seem to work for me - i'd apply the script to a layer within a precomposition to the "scale" property, having two keyframes, one at exactly the outpoint, and one one second before the outpoint. the keyframe has a custom easing curve having used the graph editor.

 

 

ip = thisComp.layer("ITEM.pdf").inPoint;
op = thisComp.layer("ITEM.pdf").outPoint;
d = key(numKeys).time - key(numKeys-1).time;
lengthDiff = op - ip - thisComp.layer("ITEM.pdf").source.duration;
if (time > (ip - d)){
    t = key(numKeys-1).time + (time - (ip - d)) + lengthDiff;
}else{
    t = Math.min(time,key(numKeys-1).time);
}
valueAtTime(t);

 

 

 

TOPICS
Expressions , How to , Scripting

Views

164

Translate

Translate

Report

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
Community Expert ,
Mar 03, 2024 Mar 03, 2024

Copy link to clipboard

Copied

LATEST

Maybe you want to use responsive design time?

 

My (paid) tool Automation Blocks for Ae also has a feature to insert frames into the active comp at the current time, which changes the duration of precomps and shifts layers and keyframes as needed.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

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