Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <div class="links"><a href="https://www.npmjs.com/package/glitched-writer" target="_blank"><svg id="npm" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 780 250" style="enable-background:new 0 0 780 250;" xml:space="preserve"><path class="st0" d="M240,250h100v-50h100V0H240V250z M340,50h50v100h-50V50z M480,0v200h100V50h50v150h50V50h50v150h50V0H480z					M0,200h100V50h50v150h50V0H0V200z"></path></svg></a></div>
<div
  class="log" id="logs">
  <p>Welcome</p>
  </div>
  <div class="text" id="glitch_this">Welcome</div><input class="input" id="input" placeholder="$" autocomplete="off" disabled="">
  <div class="input--shadow"></div>
              
            
!

CSS

              
                * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
$light-blue: #a5e5d4;
$blue: #42c3c8;
$pink: #d93da5;
$black: #1d1e22;

@mixin text-shadow($color) {
  text-shadow: 2px 4px 10px rgba($color, 0.5);
}
@mixin text-shadow-small($color) {
  text-shadow: 1px 3px 6px rgba($color, 0.5);
}
@mixin font-family {
  font-family: "M PLUS 1p", "Open Sans", sans-serif;
}
body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: $black;
  background-image: radial-gradient(rgba($blue, 0.2), $black 120%);

  &::after {
    content: "";
    position: absolute;

    // z-index: -1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
      0deg,
      rgba($black, 0.5),
      rgba($black, 0.5) 1px,
      transparent 1px,
      transparent 2px
    );
    pointer-events: none;
  }
}
::selection {
  background: $light-blue;
  color: $black;
  text-shadow: none;
}
.input {
  position: absolute;
  bottom: 30px;
  width: 240px;
  height: 35px;
  padding: 0 8px;
  background: transparent;
  outline: none;
  border: 1px solid $light-blue;
  caret-color: $blue;
  color: $light-blue;
  font-weight: 300;

  @include text-shadow-small($light-blue);
  @include font-family;

  @keyframes an {
    0%,
    50% {
      ph: visible;
    }
    51%,
    100% {
      ph: hidden;
    }
  }

  animation: an 0.9s infinite alternate;
  transition: border-color 0.1s, color 0.1s, text-shadow 0.1s,
    transform 0.3s 1.2s;

  &::placeholder {
    color: $light-blue;
    transition: opacity 0.1s, color 0.1s;
    visibility: var(ph);

    @include text-shadow-small($light-blue);
  }
  &:focus,
  &:hover {
    border-color: $blue;
    color: $blue;

    @include text-shadow-small($blue);

    &::placeholder {
      color: $blue;
    }
    &::selection {
      background: $blue;
    }
    & ~ .input--shadow {
      border-color: $blue;
    }
  }
  &:focus::placeholder {
    opacity: 0;
  }
  &:disabled {
    transform: translatey(70px);

    & ~ .input--shadow {
      transform: translatey(70px);
    }
  }
  &--shadow {
    position: absolute;
    bottom: calc(30px - 4px);
    transform: translatex(2px);
    filter: blur(4px);
    opacity: 0.5;
    width: 240px;
    height: 35px;
    border: 2px solid $light-blue;
    pointer-events: none;
    transition: transform 0.3s 1.2s;
  }
}

.gw-ghosts {
  // display: inline-block;
}

.text {
  position: relative;
  padding: 30px;
  font-size: 35px;
  color: $light-blue;
  will-change: contents, width;

  @include font-family;
  @include text-shadow($light-blue);

  &::after,
  &::before {
    content: attr(data-gw-string);
    position: absolute;
    opacity: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    padding: 30px;
    overflow: hidden;
    white-space: nowrap;
    color: $blue;
    will-change: contents, width;
  }
  &::before {
    z-index: -1;
    color: $pink;
  }
  &.gw-writing {
    animation: glitch-skew 1s steps(10, end) infinite alternate-reverse;

    .gw-ghosts, .gw-glitched {
      opacity: 0.6;
      animation: glitch-blink 1s steps(20, end) infinite alternate-reverse;
    }

    &::after,
    &::before {
      opacity: 1;
    }
    &::after {
      animation: glitch-animation-1 1.5s steps(20, end) infinite
        alternate-reverse;
    }
    &::before {
      animation: glitch-animation-2 2s steps(20, end) infinite alternate-reverse;
    }
  }
  @keyframes glitch-skew {
    $steps: 10;

    @for $i from 0 through $steps {
      #{percentage($i * 1 / $steps)} {
        transform: skew(random(10) - 5 + deg);
      }
    }
  }
  @keyframes glitch-blink {
    $steps: 20;

    @for $i from 0 through $steps {
      #{percentage($i * 1 / $steps)} {
        opacity: random(10) / 10;
      }
    }
  }
  @keyframes glitch-animation-1 {
    $steps: 20;

    @for $i from 0 through $steps {
      #{percentage($i * 1 / $steps)} {
        clip: rect(random(100) + px, 1000px, random(100) + px, 0);
        transform: skew(random(16) - 8 + deg) translatex(random(30) - 15 + px);
      }
    }
  }
  @keyframes glitch-animation-2 {
    $steps: 20;

    @for $i from 0 through $steps {
      #{percentage($i * 1 / $steps)} {
        clip: rect(random(100) + px, 1000px, random(100) + px, 0);
        transform: skew(random(10) - 5 + deg) translatex(random(20) - 10 + px);
      }
    }
  }
}
.log {
  position: absolute;
  top: 4vh;
  left: 30px;
  color: $light-blue;
  font-weight: 300;
  font-size: 13px;
  line-height: 20px;
  display: flex;
  flex-direction: column-reverse;

  @include font-family;
  @include text-shadow-small($light-blue);

  &::after {
    content: "";
    position: absolute;
    top: -2px;
    left: -7px;
    width: 1px;
    height: 100%;
    background: $light-blue;
  }
}
.links {
  position: absolute;
  bottom: 4vh;
  right: 30px;
  display: flex;

  svg {
    height: 16px;

    path {
      fill: $light-blue;
      stroke: none;
      transition: fill 0.1s;
    }
    &:hover {
      path {
        fill: $blue;
      }
    }
  }
}

              
            
!

JS

              
                import GlitchedWriter, {
  wait
} from "https://cdn.skypack.dev/glitched-writer@2.0.29";

// Glitched Writer npm module:
// https://www.npmjs.com/package/glitched-writer

const Writer = new GlitchedWriter('#glitch_this', { letterize: true }, logString);

(async  ()=> {
  await wait(1000);
  await Writer.write("my old friend.");
  
  await wait(1200);
  await Writer.write("This is only the beginning.");
  
  await wait(1500);
  await Writer.write("Please, say something...");
  
  input.removeAttribute("disabled");
})();

function logString(string) {
  logs.innerHTML += `<p>${string}</p>`;
}

input.addEventListener(
  "input",
  _.debounce(() => 
    Writer.write(input.value)
  , 500)
);

              
            
!
999px

Console