# Text jittering with Rex Typing Plugin

**URL:** <https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248>\
**Category:** Phaser 3\
**Created:** [September 14, 2021, 9:23pm UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248 "2021-09-14T21:23:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickHatBoecker](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/nickhatboecker/32/5380_2.png) [@NickHatBoecker](https://phaser.discourse.group/u/NickHatBoecker)\
**Post date:** [September 14, 2021, 9:23pm UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/1 "2021-09-14T21:23:40Z")

</div>

Hey guys,

I’m using Rex’ Plugins for [Typing](https://rexrainbow.github.io/phaser3-rex-notes/docs/site/texttyping/) and [BBCode](https://rexrainbow.github.io/phaser3-rex-notes/docs/site/bbcodetext/) Text.  
Unfortunately the text wrapping is a little wiggly.

**Example:**  
“This is the first line. After this one the text ist wrapped.  
Now the second line is here.”

The word “Now” is on line two. But while typing it’s displayed in the first line first and then jumps to the second line. I uploaded a video to demonstrate this.

[![](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/0/07f990dfe05001fe0a40f51005d4493bd89a240e.jpeg "Phaser Rex Plugins Bug:: Typer Jittering") ](https://www.youtube.com/watch?v=aJOHdSuoHqs)

You can see this in the first Text with “Choose an…” and when talking to the blonde character with "…is already…

Here’s the code:

```javascript
const textboxWidth = 700
const textPadding = 20

this.text = this.scene.add.rexBBCodeText(x, y, '', getTextStyle(textboxWidth))
this.text.setScrollFactor(0).setOrigin(0, 0).setPadding(texPadding)

this.typer = this.scene.textTyper.add(this.text)
this.typer.start(text, 30)

...

const getTextStyle = (width) => {
    return {
        lineSpacing: 10,
        fontFamily: DEFAULT_FONT,
        wrap: { // For bbcode text
            mode: 'word',
            width,
        },
        wordWrap: { width }, // For normal text
    }
}

```

Any ideas? I would be very greatful.

Best regards  
Nick

---

<div class="post-metadata">

**Author:** ![rexrainbow](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rexrainbow/32/51_2.png) [@rexrainbow](https://phaser.discourse.group/u/rexrainbow)\
**Post date:** [September 15, 2021, 4:51am UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/2 "2021-09-15T04:51:46Z")

</div>

TextTyping won’t add new-line (\n) during typing, therefore typing content will be wrapped by BBCodeText game object.

To solve this issue, try to insert ‘\n’ into typing content at typing start.

I could add this feature into plugin later, add to TODO.

---

<div class="post-metadata">

**Author:** ![NickHatBoecker](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/nickhatboecker/32/5380_2.png) [@NickHatBoecker](https://phaser.discourse.group/u/NickHatBoecker)\
**Post date:** [September 15, 2021, 8:30pm UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/3 "2021-09-15T20:30:21Z")

</div>

Thank you very much for your reply. So you mean I have to manually set where the lines should break? That would be very inconvenient for me, because I don’t know how much characters fit in the box. Maybe I’m wrong, but I thought that’s what the textwrap is for 🤔

---

<div class="post-metadata">

**Author:** ![rexrainbow](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rexrainbow/32/51_2.png) [@rexrainbow](https://phaser.discourse.group/u/rexrainbow)\
**Post date:** [September 16, 2021, 1:59am UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/4 "2021-09-16T01:59:25Z")

</div>

Add `wrap` parameter to run text-wrap before typing, see [this demo](https://codepen.io/rexrainbow/pen/abwVwNX), line 34. Please get latest version of minify file.  
Default value of this `wrap` is `false`.

---

<div class="post-metadata">

**Author:** ![NickHatBoecker](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/nickhatboecker/32/5380_2.png) [@NickHatBoecker](https://phaser.discourse.group/u/NickHatBoecker)\
**Post date:** [September 16, 2021, 3:26pm UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/5 "2021-09-16T15:26:46Z")

</div>

OMG you’re a real hero, Rex! Thank you so much - it’s working just fine!

Normally I use the npm releases. Do you have time to release an update there, too? Otherwise I just stick with the static URLs for the moment.

---

<div class="post-metadata">

**Author:** ![rexrainbow](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rexrainbow/32/51_2.png) [@rexrainbow](https://phaser.discourse.group/u/rexrainbow)\
**Post date:** [September 16, 2021, 3:48pm UTC](https://phaser.discourse.group/t/text-jittering-with-rex-typing-plugin/10248/6 "2021-09-16T15:48:54Z")

</div>

Will upgrade npm package next week.
