How to animate individual letters in a text block?

Here is how I was able to achieve it:

  • First you want to create a blueprint widget. Add a Text Box as a child to the canvas panel and make sure “Size to content” is checked as well as the “Is Variable”. Also, clear the text field.
  • Next, you want to add an animation for the text in that widget. Click the “+Animation” button. Then “+Add” > your text box. Edit the values that want. I changed the transform and opacity to somewhat match the animation gif you attached.

  • In that widget’s BP, on event construct, play the animation.

  • Now, create a new widget BP. Add a wrap box from the palette. Enable as a variable.
  • In the BP, create 2 text variables and an integer variable. In 1 text variable add the text you want to display. The next text variable is for a letter and the integer is a counter for our sentence length.

  • Now we create our logic. Create a custom event. Start this custom event after event construct. Create an array from your text and get the length. Compare the length to the integer variable we made(so that we wont go over the length in the future). Now get that letter using the letter counter integer and set it to our 2nd text variable.

  • Last, create a Letter widget we made in step 1. Add this widget as a child to the wrap box in our current widget. Access the text box from the letter widget and set it’s text to the letter variable. Increase our counter variable and add a delay in which time you see fit (this will create a wait time between our last letter animation and the next). Now start the custom event again for the next letter.

3 Likes

It should look something like this:

192373-giphy.gif

To keep it from cutting off, your printing system needs to know the length of the word, which it doesn’t if the characters are being added one at a time. You can either solve this by adding entire word widgets that are in charge of printing their own characters and saying when they’re done, or by having a character buffer with single word look-ahead.

I don’t animate my text, but I do look ahead to the next word and insert newlines if it’ll exceed my pre-defined character limit per line (gif below). I do it with text, but you could do it with character widgets as well.

As far as efficiency, it does seem a bit overkill to split them all out as separate widgets, but I think it’s just a case of an expensive effect. You could save some performance by wrapping it in a retainer box and controlling how often it’s redrawn, or by replacing the widgets with a single text widget when they’re done animating.

192415-dialog.gif

Took a while to implement correctly into my system but using word widgets that print each letter within works perfectly! Thanks a lot for the help.

192428-dialoguewrap.gif

How can i animate the individual letters of a text block like the below gif from A Hat In Time, which also seems to be using Unreal.

312329-textexample.gif

The only solution i’ve come up with so far is making each letter its own widget and adding it to a wrap box, which works but doesn’t seem efficient and also text doesn’t wrap correctly.

Any help would be much appreciated.

Hey thanks for answering. I have a similar version of this already working, its just it doesn’t seem efficient to create a new widget for every letter and also the wrap box doesnt wrap correctly. Is there any way of changing how it wraps so words dont cut off half way through?

202795-42f147ccd026d1b0c9b6510b22174758.gif

This is fantastic!!! well explained
Is there a way to do this so that no matter how long the text is…it comes in from left to right as you guys have it…but always have it be centered

like in breath of the wild

Sorry Spoilers :slight_smile: if you haven’t played it yet

Hey sorry for the delayed response but yeah you can do that. You would just have to make a widget with a size/horizontal/vertical box similar to the size of the example

in this image

I can’t figure out how to access the text block from the other widget PLEASE HELP! :frowning:

Is it possible to have your code? I would like to implement in my project. thanks

If anyone’s still having trouble with this, I worked out an incredibly easy way to do it in a few mins with some simple logic.

  1. Create two string variables, one named dialogueText and one named dialogueShowing. Set dialogueText to whatever you want to spell out on the screen, set dialogueShowing to empty.

  2. Create an int variable called counter and set it to 0

  3. Parse every character from dialogueText, take the returned array and use it to get array element with a given index, provide counter as the index.

  4. Take the single returned character from the get and append a string like so A → dialogueShowing B → single character from the get

  5. Set dialogueShowing to the newly appended string

  6. Get the length of the dialogueText returned character array, branch, provide counter == dialogueText as the bool

  7. If true, all characters have been displayed and we can then perform whatever functions after that, if false, then there are more characters to display

  8. Off the false, increase counter by 1 but clamp the value between 0 and the dialogueText char array length

  9. Delay for however long you want between each character displaying on the screen, something like 0.1 seconds will be 10 chars per seconds

  10. Off the delay link back to the setting of the dialogueShowing variable, it will show the next character as count has been increased to get the next character in the dialogueText variable

  11. Bind dialogueShowing to the text in your widget being shown on screen and call the function from event begin play or a button click or however you’re initiating the showing of the text on the screen

And BAM! Just like that you’ve got yourself text slowly revealing itself without any animation, basically like Archduke’s gif above. You can adjust how fast the text reveals itself by adjusting the time on the delay function (as a float in seconds) lower value means it will reveal faster, higher value will delay the time between each character revealing more.

Hey Danstarr13, thanks!

Adding to the question, do you know how to change / add animation to the text like in the OP’s GIF, there’s a “He He He” where the animation seems to be different, any ideas how to do that? Having trouble changing patterns mid text

you could probably look ahead to check the next word and then change the animation based on if that is the word or not you need

This is my simple solution. I swaped a wrap box to a vertical box and create new widget with empty wrap box. I manualy add specific symbol to end of row in mySentence variable. When it finds this specific symbol, a new wrap box is created in the vertical box slot.