-
Crossing Keys and changing values…
I have a project with a text layer displaying text spoken by a narrator.
The current word being spoken changes its Fill Color as a narrator speaks.That much of the script works beautifully… (I must thank the amazing Mr. Dan Ebberts for posting his snippets of wisdom on these forums for making this much possible).
The layer, “transcribedSOUND.wav” is an audio layer, peppered with transcription markers as processed by Adobe Premiere and Adobe Media Encoder.
Now, here’s my issue…
The text layer has an animated sourceText value.
So, every time I encounter a text keyframe, I’d love to be able to set my variable, HLword back to one (1).Though, I seem to be getting lost every time I include this in a similar if…else statement.
I think it should go like this:
xx = 0;
if (text.sourceText.numKeys > 0)
{xx = text.sourceText.nearestKey(time).index;
if (text.sourceText.key(xx).time > time) xx–;
}
if (xx > 1)
{if (xx%2)
{SOMETHING}
else
{SOMETHING}
}
else
{SOMETHING_ELSE}transSOUND = thisComp.layer("transcribedSOUND.wav");
HLword = 0;
n = 0;
if (transSOUND.marker.numKeys > 0)
{n = transSOUND.marker.nearestKey(time).index;
if (transSOUND.marker.key(n).time > time) n--;
}
if (n > 0)
{if (n%2)
{HLword = n;}
else
{HLword = n;}
}
else
{HLword;}