Copy link to clipboard
Copied
I’m trying to create a typewriter effect, where text appears letter by letter, and whenever an end of line is reached, it the text scrolls one line upwards.
It needs to be moving in sync with the audio, so I need to be able to add pauses and holds.
I have inherited a project where this has been done in an incredibly complicated way, but I'm wondering if there might be a plug in or some code that could help??
Thanks in advance
Copy link to clipboard
Copied
Maybe using 2 expressions and 2 slider controls:
source text:
spd = effect("TypeWrite Speed")(1);
text.sourceText.substr(0, time * spd)
position:
lineHeight = effect("Line Height")(1);
[value[0], value[1] - (text.sourceText.split('\r').length -1) * lineHeight]
Copy link to clipboard
Copied
I probably missed the most important feature:
the ability to pause and play the animation.
You might want to add a checkbox control ("Pause / Play") for this function.
source text expression:
spd = effect("TypeWrite Speed")(1);
s = effect("Pause / Play")(1);
t = time;
if (s.numKeys) {
key = s.nearestKey(time).index;
if (time < s.key(key).time) key--;
if (key) {
pause = 0;
for (var i = 2; i <= key; i += 2) {
pause += s.key(i).time - s.key(i - 1).time;
}
t = key % 2 === 1 ? s.key(key).time - pause : t - pause;
}
}
text.sourceText.substr(0, t * spd);