I am trying to set up a render duration that can be controlled by how many pages are defined in the project, where each page has a defined duration.
I am somewhat new to expressions and I do not understand where I should put the expression so it executes when I render. I am controlling the page durations with time-remapping expressions in a nested comp. Any help is greatly appreciated.
here is my expression:
var fps = 1/ thisComp.frameDuration;
//text source
var pgs = comp("_Color_Cnt").layer("pages").text.sourceText
var aTR = comp("_Color_Cnt").layer("trans").text.sourceText
var bH = comp("_Color_Cnt").layer("hold1").text.sourceText
var cH = comp("_Color_Cnt").layer("hold2”).text.sourceText
//make absolute number * fps
var PAGES = Math.abs(pgs)*fps;
var TR = Math.abs(aTR)*fps;
var HO1 = Math.abs(bH)*fps;
var HO2 = Math.abs(cH)*fps;
//define duration value (115 is intro, TR is transition, HO is hold-frame duration)
var dur0 = 115
var dur1 = 115 + TR + HO1
var dur2 = 115 + TR + HO1 + TR + HO2
//set duration of render
if (PAGES == 1) {
var duration = dur1;
} else if (PAGES == 2) {
var duration = dur2;
} else {
var duration = dur0;
}
thisComp.workAreaDuration = duration;
Help setting the render duration
You can change the speed a layer, but can't change the duration of a layer using Expression. You can change the duration using ExtendScript, so if you go to the ExtendScript part of the site somebody should be able to help you. Unfortunately, I can't help in that language because I'm still learning it myself.
For Expression Tutorials:
https://www.youtube.com/c/CodingAfterEffects
https://www.youtube.com/c/CodingAfterEffects