block-reveal.js
3 months ago
blur-in.js
3 months ago
bounce-in.js
3 months ago
drop-in.js
3 months ago
fade-in.js
3 months ago
flash.js
3 months ago
flicker.js
3 months ago
flip-in.js
3 months ago
glitch-rgb.js
3 months ago
glitch.js
3 months ago
glow-in.js
3 months ago
pulse-neon.js
3 months ago
pulse.js
3 months ago
random-reveal.js
3 months ago
roll-in.js
3 months ago
rotate-in.js
3 months ago
rubber-band.js
3 months ago
scale-in.js
3 months ago
shadow-pop.js
3 months ago
shuffle-text.js
3 months ago
slide-down.js
3 months ago
slide-left.js
3 months ago
slide-right.js
3 months ago
slide-up.js
3 months ago
solid-outline.js
3 months ago
squeeze.js
3 months ago
stretch.js
3 months ago
swing.js
3 months ago
terminal-type.js
3 months ago
tracking-expand.js
3 months ago
typewriter.js
3 months ago
water-drop.js
3 months ago
wave.js
3 months ago
terminal-type.js
38 lines
| 1 | ( function () { |
| 2 | 'use strict'; |
| 3 | |
| 4 | var INTERVAL = 100; |
| 5 | |
| 6 | function play( el ) { |
| 7 | var text = el.getAttribute( 'data-original-text' ) || el.textContent.trim(); |
| 8 | el.setAttribute( 'data-original-text', text ); |
| 9 | el.innerHTML = ''; |
| 10 | |
| 11 | var textSpan = document.createElement( 'span' ); |
| 12 | var cursor = document.createElement( 'span' ); |
| 13 | cursor.style.cssText = 'display:inline-block;width:0.6em;height:1.1em;background:currentColor;margin-left:4px;vertical-align:middle;animation:frblBlinkCursor 1s infinite;'; |
| 14 | |
| 15 | el.appendChild( textSpan ); |
| 16 | el.appendChild( cursor ); |
| 17 | |
| 18 | var chars = text.split( '' ); |
| 19 | var i = 0; |
| 20 | var timer; |
| 21 | |
| 22 | function type() { |
| 23 | if ( i < chars.length ) { |
| 24 | textSpan.textContent += chars[ i ]; |
| 25 | i++; |
| 26 | timer = setTimeout( type, INTERVAL ); |
| 27 | } else { |
| 28 | timer = el._frblLoop && setTimeout( function () { play( el ); }, 2500 ); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | type(); |
| 33 | } |
| 34 | |
| 35 | window.FrblAnimations = window.FrblAnimations || {}; |
| 36 | window.FrblAnimations['terminal-type'] = play; |
| 37 | } )(); |
| 38 |