Carter Lilley
Forum Replies Created
-
Carter Lilley
November 8, 2022 at 7:46 am in reply to: Need to trigger animation any time there is a marker.Scratch that – you gave me exactly what I needed.
I’ll clean this up and post the full script at some point Julian Chojnacki!
-
Carter Lilley
November 8, 2022 at 7:40 am in reply to: Need to trigger animation any time there is a marker.Thanks, messing around with this now.
Maybe this is sailing way over my head – but how do I derive and pass the time for those indexes? I understand that “marker.key(textindex).time” when subtracted from time will always give me the starting points of identical textindex and marker pairs…which is why I was attempting to offset it by “numWords” each time there’s a phrase change. (This does work if I do it manually by adding a keyframed value equal to the total number of accumulated words so far to textIndex, but requires me to manually keyframe this value as in increments. As stated above not sure how to “store” this variable for use over time as it gets bigger).
We might be getting crossed wires here because there are two approaches to this – one based on the number of markers per phrase, and one based on the number of words per phrase (which will break if there isn’t a “correct” amount of markers.)
I was attempting to figure out the (hopefully) easier way of doing it based on the number of words in the phrase, making the number of markers irrelevant so long as they are the same as the number of words.
Does any of this make sense? I’ve been staring at this code a while and my head is starting to hurt haha. Expression selectors are incredibly powerful but I feel like they are not well documented.
-
Carter Lilley
November 8, 2022 at 4:34 am in reply to: Need to trigger animation any time there is a marker.Aaah, but unfortunately I am tying the marker timings to the text index from 0-X on each phrase in this part – marker.key(textindex).time
All I need to do is offset it by the number of words in each phrase every time there’s a new keyframe, but I cant seem to figure out how to properly store and increment that variable, if that makes sense.
Unless there’s a simpler way that I’m not seeing!
-
Carter Lilley
November 8, 2022 at 3:45 am in reply to: Need to trigger animation any time there is a marker.Okay, some further refinement here shows me that I just need to add the total number of words from the previous phrase to the textIndex at the begging of each phrase. So let’s say the first phrase has eight words – starting at zero – you’d run through the textIndex normally, and then when the new phrase begins, you would simply add “textIndex+8” to the running tally, so the text index “begins again” on word 8.
I’m so close I can taste it! Unfortunately, I am at a loss as to how to properly “store” and increment variables in AE as it’s independent of time. (Say updating the running total word tally every time I keyframe the text property) Any clarity as to how I can do this?
-
Carter Lilley
November 8, 2022 at 1:07 am in reply to: Need to trigger animation any time there is a marker.Hey all, trying to solve the same exact problem here. The goal: keyframe a text property with new sentences throughout (in my case) a music track. Then, retime each word of each phrase with markers – essentially creating a lyric video generator on one track and applying a flexible text animator to every word of every phrase. Seems extremely powerful.
I’ve messed around with your code a lot and am close, but just hoping for a little further guidance.
I have just about every variable I think I would need for this, I’m just not sure how to plug them in. I know how many words (and markers) are in each phrase. When each phrase begins and ends, and how to pair text to markers.
In bold below is the problem area, however. TextIndex is very confusing to me – I’m not sure how to appropriately “step” through the text index on a “per phrase” basis, so it goes 0-X for each phrase, X being the number of words in the phrase.
Any help would be appreciated!!
anim = thisProperty; //this property
m = text.sourceText; //text property
if (m.numKeys > 0){
n = m.nearestKey(time).index; //this is the current phrase index
if (m.key(n).time > time) n--;
}
if (n > 0){
t1 = m.key(n).time; //this is the current phrase starting time
if (n < m.numKeys){
t2 = m.key(n+1).time; //this is the next phrase starting time
}else{
t2 = t1 + .5;
}
numWords = text.sourceText.valueAtTime(t1).split(/ ,| | \./).length; //number of words in the current phrase
nextPhrasemarkerID = marker.nearestKey(t2).index; //ID of next phrase's FIRST marker
currPhrasemarkerID = marker.nearestKey(t1).index; //ID of current phrase's FIRST marker
numMarkersperPhrase = (nextPhrasemarkerID - currPhrasemarkerID); //number of markers in the current phrase
}
delay = marker.key(textIndex).time;
//this is the time of the marker index which matches the text index. first marker, first word, second marker, second word - etc.
anim.valueAtTime(time - delay)