Skip to content

Instantly share code, notes, and snippets.

@seblavoie
Created March 17, 2014 18:48
Show Gist options
  • Save seblavoie/9605736 to your computer and use it in GitHub Desktop.
Save seblavoie/9605736 to your computer and use it in GitHub Desktop.
Show subtitles. See http://www.youtube.com/watch?v=4LAnZPDUOiI for details.
L = thisComp.layer("the layer");
max = 5; // number of words to display
n = 0
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time){
n--;
}
}
s = " ";
if (n > 0){
base = Math.floor((n-1)/max)*max + 1;
for (i = base; i < base + max; i++){
if (i <= L.marker.numKeys){
s += L.marker.key(i).comment + " ";
}
}
}
s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment