0 votes
by (120 points)
retagged by

Hi. 

When i write big text in Typewriter Effect, the text begins to appears slower and slowe and slower towards the end. 

Of course, i want to the text displayed evenly. 

Smb help and explain it, please.

(set: $typewriterText to "huge text that appears on the page")

{
(set: $typewriterPos to 1)
|typewriterOutput>[]

(live: 20ms)

[
(append: ?typewriterOutput) [(print: $typewriterText's $typewriterPos)]

(set: $typewriterPos to it + 1)
(if: $typewriterPos is $typewriterText's length + 1)

[(stop:)]

]
}

 

1 Answer

0 votes
by (2.7k points)
Hi, I could reproduce the issue. I copy-pasted your example sentence so that the text to display had round about 300 words. Speed of typewriter effect decreases significantly in the end.

But I have no idea what to do against this effect.
by (120 points)
Um... Maybe you (or someone else) will offer another code?

It should print the entire text with the typewriter effect and same speed.

I would be glad if you (or someone else) will help.
by (159k points)
It takes time to process & execute each of the steps within the (live:) macro's associated hook, and that time becomes slightly longer each time the code in the associated hook is executed.

The main cause of the increase in the execution time is a result of the extra effort the (append:) macro need to perform each time it is called, which is explained by the following steps:

1. The macro needs to search ALL of the current page to find all occurrences of the indicated hook. The time needed to do this slowly increases as more and more text is revealed.

2. The macro needs to locate the last child element of the hook parent. This also takes a little longer each time.

3. The macro inserts the new element containing the next letter to be shown.

4. The page is refreshed (known as rendered) so the newly added letter becomes visible. This also can take a little longer each time.

5. The (live:) macro creates another timer event and the once the delay has passed the (append:) macro is called again and the above steps happen again.
by (120 points)
That sounds perfectly logical. :D

Thank you for explaining the problem.
...