Skip to main content
Participant
Jul 26, 2024 12:24 AM UTC
Question

Create scrolling digital typewriter text

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

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Legend
Jul 26, 2024 2:41 AM UTC

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]

 

 

 

Translate
Legend
Jul 26, 2024 1:09 PM UTC

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);

 

Translate