-
Animation triggered by markers (once again…)
Hello!
I’ve spent the last couple of days trying to solve this but I still lack of some javascript knowledge.
I searched the forums and tweaked some expressions. It almost worked the way I need except it stopped halfway(?). ????The thing is…
I have a text layer with notes, one by line, as you can see on the left. (It’s for a music teaching project.)
The idea is to connect the marker index and the text line index (+1 because line counting starts from 0 and markers from 1).Example:
The 3rd marker (marker index = 3) will get me the 3rd line on the text layer. In that case it’s “A2”.
If the layer name is “A2”, its opacity goes to 100% until the next marker. (Unless the next marker calls the same note on the text layer).This is the expression on the Fill effect on the layers called A2, F and D:
(The layer “notas” contain all the notes one by line. )txt = thisComp.layer("notas").text.sourceText.split("\r");
nota = thisLayer.name;m = thisComp.marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if ((n > 0) && (txt[m.key(n).index+1] == nota)){
100;
}else
0So… it worked until it doesn’t as you can see on the gif. There are 9 lines of text for 9 markers.
It looks like a very specific doubt but the idea is simple.
The marker index defines the text line and if its content equals the layer name, opacity goes 100.
It must last until the next marker unless it’s the same content.I think I’m this close…
edit: I tried to understand and steal this code on Dan’s page.
https://www.motionscript.com/design-guide/marker-sync.html
but I couldn’t understand it properly…Thanks in advance.
