# Animation nodes loop text problem

Hello wonderful people!

A problem solving mind needed here... I have expired the use of mine...

AIM:

To create a text animation sequence (for character dialogue) with a style that types into place letter by letter and then opacity fades, then repeats several times with different text objects - using animation nodes.

PROPOSED METHOD:

To have several text objects in a list, which will cycle through in an animation sequence as follows: Text object one will appear letter by letter as if being typed into place, then it will hold for a second and fade out. Then text object one will move out of place and in its place text object two will be placed, then it will animate in the same way - type into designated area, then hold for a second then fade, then for the remaining text objects.

THE STORY SO FAR...

I created 3 text objects, put them in a list and have a repeated time of 70 frames, during which the text is trimmed to give typing effect. I created some math and logic to give us a signal when the repeat cycle is complete, so that when 70 frames is up, a 1 is given which could then trigger the next text object in the list, but I am not sure how to change the index of the text object list to the next in the sequence...

Please see the screenshot of the nodes setup and the blender 2.8 .blend file is also attached.

blend file:

current frame minus the numpy expression. math result in to trim text end, to give the amout of text trimming. then the text selected list goes in to the text input of the trim node.

The integer list of the recursive sum loop is received from the text length node, which outputs a list of integers, which are the character lengths of each text item in the text list.

The sum integer gives a delay before the text animates. The padding integer gives a delay between each item list animation.

• ah, thank you kindly, here's the link to the blend file: <img src="https://blend-exchange.giantcowfilms.com/embedImage.png?bid=5941" /> – Li Brinto Feb 26 '19 at 10:16
• @LiBrinto Welcome to stackexchange! Not entirely sure what you are trying to achieve. Can you split the question into two parts: (1) What do you want to achieve in details, perhaps and illustration or an example. (2) What did you try so far. – Omar Emara Feb 26 '19 at 11:42
• Hi Omar, thanks. My ultimate aim is to have several text objects which will cycle through in an animation sequence as follows. Text object one will appear letter by letter as if being typed into place, then it will hold for a second and fade out . Then text object one will move out of place and in its place text object two will be placed, then it will animate in the same way - type into designated area, then hold for a second then fade, then for the remaining text objects. – Li Brinto Feb 26 '19 at 13:30
• @LiBrinto Everything thing alright? Did you manage to replicate this? – Omar Emara Feb 27 '19 at 7:51

I am assuming you want to maintain a uniform typing speed across texts. In which case, we can assign a weight to each text based some other factor. This weight act as a duration multiplier to maintain a uniform typing animation. In this case, I will choose the length of the text as the weight. Next, I will compute a list that represents the starting times of each animation based on the weights we just computed. This can be done using a simple loop as follows:

The padding is just a constant added to pad the duration allowing for holding the animation for some time. Next, we want to know, at any time, which text are we typing. To do that we use the following numpy expression:

numpy.argmax(sums.asNumpyArray() > frame) - 1


It basically gets the index of the first element in the sums list that is larger than the current frame.

Make sure to import numpy in the Advanced Node Settings of the Expression node. Next, we get the text and its starting time at the output index, we subtract the its starting time from the time and use that as the end trim value as follows:

Now, lets divide the time to slow it down a bit and see what the result:

Increasing the padding will increase the interval between the starting animation of each text. The fading effect can be created just as we did, so I will let you do that on your own.