Forum Discussion

CraigJohnson-9d's avatar
CraigJohnson-9d
Community Member
24 days ago

Animated on Screen Text (Chat GPT Style)

Hey everyone! I'm looking for a way to solve a customer request of animating the text to speech to show on screen like you'd see as Chat GPT is writing text on screen word by word. I can't think of a way to do this in Storyline currently and wondering if anyone has a way to complete this without using CC. Thank you in advance!

2 Replies

  • var player = GetPlayer();
    var newIncomingText = player.GetVar("newText");
    var newOutgoingText = "";
    var myArray = newIncomingText.split("");
    var arrayLength = myArray.length;
    function typeText() {
     newOutgoingText = newOutgoingText + myArray[0];
     myArray.shift();
    player.SetVar("displayText",newOutgoingText);
     arrayLength = myArray.length;
     if (arrayLength == 0) {
     clearInterval(myInterval);
     }
     }
    // A letter is typed every 100ms, adjust the typing speed by changing the 100 number below
    var myInterval = setInterval(typeText, 100); 

    There is javascript on here to achieve that, this is some old code I used to do it one character at a time.

     

    • CraigJohnson-9d's avatar
      CraigJohnson-9d
      Community Member

      Thank you! I haven't personally used javascript, how would I insert this into Storyline to accomplish the effect?