Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
<head>
  <title>Document</title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  
</head>
<body>
<header>
<div class="transformers">
  <div class="t3xts t3xt-1">Amazing</div>
  <div class="t3xts t3xt-2">3D text</div>
  <div class="t3xts t3xt-3">For your</div>
  <div class="t3xts t3xt-4">site</div>
</div>
 
</header>
</body>
</html>
              
            
!

CSS

              
                body
  background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(220,220,222,1) 30%, rgba(0,0,0,0.4) 100%)
  background-repeat: no-repeat
  height: 100vh

.transformers
  position: relative
  margin: auto
  padding-top: 15%
  .t3xts
    letter-spacing: 1px
    font-family: 'Anton' , sans-serif
    font-size: 70px
    font-weight: 600
    color: #fff
    line-height: 1
    position: relative
    text-transform: uppercase
    text-align: center
    width: 100%
    text-shadow: 0px 3px 0px #b2a98f, 0px 14px 10px rgba(0,0,0,0.15), 0px 24px 2px rgba(0,0,0,0.1), 0px 34px 30px rgba(0,0,0,0.1)
  .t3xt
    position: absolute
    text-transform: uppercase
    top: 0
    bottom: 0
    left: 0
    right: 0
  .t3xt-out
    animation: text-out 0.5s ease
  .t3xt-in
    animation: text-in 0.5s ease

  @keyframes text-out
    to
      transform: rotateX(-90deg)
      opacity: 0

  @keyframes text-in
    from
      opacity: 0
      transform: rotateX(90deg)

    to
      transform: rotateX(0deg)
      opacity: 1

  
    


    

              
            
!

JS

              
                function n3xt(text, element) {
var sample = document.querySelector(element);
if (sample.dataset.animating === 'true') return;
var sampleH = 70; // будет держать текст фиксированным, в противном случае - offsetHeight
var sampleT = sample.textContent; // старый текст
var sampleNT = text; // новый текст
sample.dataset.animating = 'true';
sample.style.height = sampleH + 'px';

// исходный текстовый блок
var samO = document.createElement('div');
samO.style.transformOrigin = '0 ' + sampleH / 2 + 'px -' + sampleH / 2 + 'px';
samO.classList.add('t3xt');
samO.textContent = sampleT;

// новый текстовый блок
var samN = samO.cloneNode();
samN.textContent = sampleNT;
sample.textContent = '';
sample.appendChild(samO);
sample.appendChild(samN);

samO.classList.add('t3xt-out');
samN.classList.add('t3xt-in');

samN.addEventListener('animationend', function (event) {
sample.removeChild(samO);
sample.removeChild(samN);
sample.textContent = sampleNT;
sample.dataset.animating = 'false';
});
}

var phraseIndex = 1;
var wordIndex = 0;
var t3xts = [
["Awesome", "Incredible", "Funny", "Best"],
["Amazing", "3DText", "For your", "Site" ],
];

// Задержка начала анимации
setTimeout(changetext, 2000);
// Количество строк анимации 
// 4 = (wordIndex > 3)
// 3 = (wordIndex > 2)...
function changetext() {
if (wordIndex > 3) {
wordIndex = 0;
phraseIndex++;
}
if (phraseIndex >= t3xts.length) {
phraseIndex = 0;
}
var term = t3xts[phraseIndex][wordIndex];
n3xt(term, '.t3xt-' + ++wordIndex);
// Количество строк для анимации с учётом общего таймаута:
//если wordIndex == 4 то строк учавствует 4
//если wordIndex == 2 то строки 2, затем следующие 2 после времени общего таймаута
if (wordIndex == 4) {
//Общий таймаут:
//Задержка анимации между строк (var t3xts = [])
setTimeout(changetext, 5000);
} else {
//Таймаут анимации строк:
//Меньше цифры - быстрее прокрутка всех строк
//Больше цифры - медленее и построчно
setTimeout(changetext, 200);
}
}

              
            
!
999px

Console