After Effects PunctuationExpression Help

Job ID: 39206259

Budget: ₹1,500 – ₹12,500 INR

New After Effects user here, and ChatGPT can only get me so far with my expressions as I am no coding Guru. I need help with my AE punctuation expression. It starts out working ok, but then after subsequent pauses it adds letters of the next word with each pause. I need the expression fixed and optimized or an entirely new expression created if you know a better workaround so I can reuse the same expression on the remaining portions of my text presentation. This is what I have so far and I can provide you with the .aep and text file as well. I've uploaded a video so you can see the issue.



t = time - inPoint;

charDelay = 0.045;



punctuation = {

",": 0.3,

".": 0.5,

"!": 0.4,

"?": 0.4,

"-": 0.5,

"—": 0.7,

";": 0.6,

"\n": 1.0

};



txt = text.sourceText.value;

totalTime = 0;



for (i = 0; i <= textIndex; i++) {

if (i > 0) {

currentChar = txt.charAt(i - 1);

totalTime += charDelay;

if (punctuation.hasOwnProperty(currentChar)) {

totalTime += punctuation[currentChar];

}

}

}



ease(t, totalTime, totalTime + charDelay, 100, 0);