Copy link to clipboard
Copied
Hello, I am working with this expression for subtitles but the subtitle stays on even until the next marker. I want subtitle to disappear when there's a gap between markers.
Any help?
Here's the expression I am using;
m = thisComp.layer(1).marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time){
n--;
}
}
if (n == 0){
""
}else{
m.key(n).comment;
}
Try it this way:
m = thisComp.layer(1).marker;
n = 0;
val = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - m.key(n).time;
if (t < m.key(n).duration){
val = m.key(n).comment;
}
}
val
Copy link to clipboard
Copied
Try it this way:
m = thisComp.layer(1).marker;
n = 0;
val = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - m.key(n).time;
if (t < m.key(n).duration){
val = m.key(n).comment;
}
}
val
Copy link to clipboard
Copied
Thank you very much, Dan Ebberts.