There’s probably a more compact way, but this is what I came up with:
Expression for sourceText:
prefix = "decode your < ";
phrases = ["life","the universe", "everything"];
suffix = " >";
cursor = "_";
char_map=[];
for (phrase of phrases) {
for (i=0; i<phrase.length; i++) {
char_map.push(phrase.substr(0,i));
}
for (i=phrase.length; i>0; i--) {
char_map.push(phrase.substr(0,i));
}
}
char_map.push("");
char_index=clamp(Math.floor(effect("char")("Slider").value) , 0, char_map.length-1);
insert = char_map[char_index];
prefix+insert+cursor+suffix;
Add a slider named “char” and animate that from 0 to … (in this example 52) which is the number of virtual keystrokes, including the backspaces to erase letters.
This way you can manually adjust the timing of how long you want a word to stay, should it backspace faster than it types etc.
Or if you want to automate this, just put an expression on the slider like “time*5;”
Please don’t ask for an expression that has variable timings before and after each word is complete, and different speeds etc. it took me longer to type this sentence than it would to simply keyframe that using the char-slider ?
Blinking the Cursor is pretty easy with a text_animator:
– range Selector set to index of characters
– Start: text.sourceText.indexOf("_");
– End: text.sourceText.indexOf("_") + 1;
The opacity of that animator could have an expression in the vain of
if (effect("char")("Slider").speed==0) linear(time%1.5, .75, 1.25, 100,0); else 100;
to blink the cursor, but only when it’s not typing.
Auto-sizing Text-boxes using sourceRectAtTime() should be easy enough to find, I prefer the ones that actually draw a path instead of a rectangle.