> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.unicornplatform.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Typing text animation

This guide will show you how to create an eye-catching typing text animation for your headlines in just a few steps.

![](https://storage.crisp.chat/users/helpdesk/website/7e782a40c0560c00/ezgifcom-gif-maker_ja5k8k.gif)

#### Step 1/5

Copy this code:

```
<script>
var TxtRotate = function(el, toRotate, period) {
  this.toRotate = toRotate;
  this.el = el;
  this.loopNum = 0;
  this.period = parseInt(period, 10) || 2000;
  this.txt = '';
  this.tick();
  this.isDeleting = false;
};

TxtRotate.prototype.tick = function() {
  var i = this.loopNum % this.toRotate.length;
  var fullTxt = this.toRotate[i];

  if (this.isDeleting) {
    this.txt = fullTxt.substring(0, this.txt.length - 1);
  } else {
    this.txt = fullTxt.substring(0, this.txt.length + 1);
  }

  this.el.innerHTML = '<span class="wrap">'+this.txt+'</span>';

  var that = this;
  var delta = 300 - Math.random() * 100;

  if (this.isDeleting) { delta /= 2; }

  if (!this.isDeleting && this.txt === fullTxt) {
    delta = this.period;
    this.isDeleting = true;
  } else if (this.isDeleting && this.txt === '') {
    this.isDeleting = false;
    this.loopNum++;
    delta = 500;
  }

  setTimeout(function() {
    that.tick();
  }, delta);
};

window.onload = function() {
  var elements = document.getElementsByClassName('txt-rotate');
  for (var i=0; i<elements.length; i++) {
    var toRotate = elements[i].getAttribute('data-rotate');
    var period = elements[i].getAttribute('data-period');
    if (toRotate) {
      new TxtRotate(elements[i], JSON.parse(toRotate), period);
    }
  }

  var css = document.createElement("style");
  css.type = "text/css";
  css.innerHTML = ".txt-rotate > .wrap { border-right: 0.08em solid #303030 } .txt-rotate, .wrap { font-family: inherit !important;}";
  document.body.appendChild(css);
};
</script>
```

#### Step 2/5

Paste it into your **Settings** -> **General settings** > **Global <body> HTML code**

![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_svyetm.png =500x500)

#### Step 3/5

In the following code, replace the words that will be animated with your own ones:

```
<span class="txt-rotate"   data-period="2000"      data-rotate='[ "Makers", "Founders", "Hackers" ]'></span>
```

This is what you need to replace (make sure to keep the quotes!):

![](https://storage.crisp.chat/users/helpdesk/website/7e782a40c0560c00/image_7f8lo1.png)

You can add or remove any number of words. For example, this is the code with only 2 words:

```
<span class="txt-rotate"   data-period="2000"      data-rotate='[ "Makers", "Founders" ]'></span>
```

And this is the same code with 5 words:

```
<span class="txt-rotate"   data-period="2000"      data-rotate='[ "Makers", "Founders", "Hackers", "Coders", "Marketers" ]'></span>
```

This step may seem a little tricky, but it's much easier than it looks 😉

#### Step 4/5

Copy the code from step 3 and paste it inside the required headline field (at the very end):

![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_1qygogp.png =1000x1000)


#### Step 5/5

Write text that will be placed before the animated part:


![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_e42q9.png =600x600)


#### Done!

Save changed and open the live version of your website to see the results 🔥

#### Additional adjustments

If the width of your headline is too big, you might see constant shifts:

![](https://storage.crisp.chat/users/helpdesk/website/7e782a40c0560c00/ezgifcom-gif-maker-1_7w461q.gif)

To fix that, simply move the animated part to the new line by adding tag `<br>` next to its code:

![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_1foncg.png =600x600)

You also might want to change the colour of the cursor.

To do so, go to the code that you added to your **Settings** -> **General settings** > **Global <body> HTML code** and replace the colour code here:

![](https://storage.crisp.chat/users/helpdesk/website/7e782a40c0560c00/image_2li7os.png)