Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random speed typewriter with a blinking cursor

  • Random speed typewriter with a blinking cursor

    Posted by Icaro Lobo on December 1, 2018 at 8:28 pm

    I’ve been using this Dan’s expression:
    minRate = 3;
    maxRate = 6;
    charCount = 0;
    t = inPoint;
    seedRandom(index,true);
    while (t < time){
    charCount++;
    t += framesToTime(random(minRate,maxRate));
    }
    value.substr(0,charCount)

    and I want to add a blinking cursor (“|”) and the end but can’t figure it out.

    Can anyone point me in the right direction?

    Thanks.

    Icaro Lobo replied 7 years, 5 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    December 1, 2018 at 9:05 pm

    Play around with this:


    minRate = 3;
    maxRate = 6;
    blinkRate = 2;
    charCount = 0;
    t = inPoint;
    seedRandom(index,true);
    while (t < time){
    charCount++;
    t += framesToTime(random(minRate,maxRate));
    }
    value.substr(0,charCount) + (Math.floor(time*blinkRate)%2 ? "|" : "")

    Dan

  • Icaro Lobo

    December 1, 2018 at 9:11 pm

    Dan, thank you very much.
    Is there a way to change the color of the cursor itself?

  • Dan Ebberts

    December 1, 2018 at 9:17 pm

    Change the last line to this:

    value.substr(0,charCount) + (Math.floor(time*blinkRate)%2 ? “|” : ” “)

    Then add a Fill Color animator, add an Expression Selector, and add this expression to the Expression Selector’s Amount property:

    textIndex == textTotal ? 100 : 0

    Dan

  • Icaro Lobo

    December 1, 2018 at 9:21 pm

    Dan, this works partially for me. When the cursor is not on the “ON” state(showing), the last letter is red.
    How to apply the color only to the cursor itself?

    Thanks again.

  • Dan Ebberts

    December 1, 2018 at 9:24 pm

    Did you change the last line of the Source Text expression to this:

    value.substr(0,charCount) + (Math.floor(time*blinkRate)%2 ? “|” : ” “)

    Dan

  • Icaro Lobo

    December 1, 2018 at 9:29 pm

    I did, the last letter is red when the cursor is not on the screen.

  • Icaro Lobo

    December 1, 2018 at 9:31 pm

    Sorry, I redid it and it worked. As usual, the operator was the error.

    Thanks a lot!

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