Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions typewriter for text but with a twist

  • typewriter for text but with a twist

    Posted by Hamood Hallak on July 29, 2020 at 7:34 am

    i need to make text appear as typewritter effects BUT
    for example this is my sentence

    decode your < future >
    the words (decode you < ) will stay on screen
    and the word ( future ) will have to be typewritten and then removed and then another word will come in place and another and another
    with the bracket at the end still there like this

    decode you < future >
    < more >
    < life >

    so just the word need to be typewritten but the brackets need to stay on screen
    and all that with a blinking cursor and the ability to change the color for each element

    anyone can help please its urgent

    Filip Vandueren replied 6 years, 1 month ago 2 Members · 5 Replies
  • 5 Replies
  • Filip Vandueren

    July 29, 2020 at 12:24 pm

    It’s very very easy to achieve with multiple text layers and basic animation.

    What exactly would you need an expression for ?

  • Hamood Hallak

    July 29, 2020 at 12:28 pm

    its for 10 social posts and each one will have around 5 changing words
    so animating all that with the blinking cursor and the brackets seems a bit too much work for something that might be solved with expressions

    …. but i forgot to mention that there is a box changing size according to the text layer

  • Filip Vandueren

    July 29, 2020 at 1:29 pm

    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.

  • Hamood Hallak

    July 29, 2020 at 1:55 pm

    worked like a charm thanks
    but the blinking cursor is very slow it only blinks once no matter how long the pause is on the sliders keyframes
    is there a way to control the speed of it and if it can only go to 0 or 100 and nothing in between

    again i appreciate the help

  • Filip Vandueren

    July 29, 2020 at 2:09 pm

    That’s strange, for me it blinks every 1.5 seconds when there’s no change in the sliders.
    Maybe use Hold Keyframes in the slider to be absolutely sure.

    This would be a hard on/off blink, once per second:

    if (effect("char")("Slider").speed==0) {
    time%1 < 0.5 ? 100 : 0;
    } else {
    100;
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy