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

Auto Save

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="container">
  <!-- SVG filter definitions -->
  <svg xmlns="http://www.w3.org/2000/svg" width="0" height="0">
    <defs>
      <filter
        id="bloom-filter"
        width="200%"
        height="200%"
        x="-50%"
        y="-50%"
      >
        <feComponentTransfer result="amplified">
          <feFuncR type="linear" slope="0.7" intercept="0"></feFuncR>
          <feFuncG type="linear" slope="0.7" intercept="0"></feFuncG>
          <feFuncB type="linear" slope="0.7" intercept="0"></feFuncB>
        </feComponentTransfer>
        <feColorMatrix in="amplified" type="saturate" values="0" result="desaturated"></feColorMatrix>
        <feComponentTransfer in="desaturated" result="thresholded">
          <feFuncR type="table" tableValues="0,1"></feFuncR>
          <feFuncG type="table" tableValues="0,1"></feFuncG>
          <feFuncB type="table" tableValues="0,1"></feFuncB>
        </feComponentTransfer>
        <feColorMatrix
          in="thresholded"
          type="matrix"
          values="1 0 0 0 0
                  0 1 0 0 0
                  0 0 1 0 0
                  1 0 0 0 0"
          result="alphaMask"
        ></feColorMatrix>
        <feComposite
          in="SourceGraphic"
          in2="alphaMask"
          operator="arithmetic"
          k1="1"
          k2="0"
          k3="0"
          k4="0"
          result="maskedSource"
        ></feComposite>
        <feComponentTransfer in="maskedSource" result="brightened">
          <feFuncR type="linear" slope="1"></feFuncR>
          <feFuncG type="linear" slope="1"></feFuncG>
          <feFuncB type="linear" slope="1"></feFuncB>
        </feComponentTransfer>
        <feGaussianBlur
          in="brightened"
          stdDeviation="10"
          edgeMode="none"
          result="blurredBloom"
        ></feGaussianBlur>
        <feGaussianBlur
          in="brightened"
          stdDeviation="4"
          edgeMode="none"
          result="blurredBloom2"
        ></feGaussianBlur>
        <feComposite
          in="SourceGraphic"
          in2="blurredBloom"
          operator="arithmetic"
          k1="0"
          k2="1"
          k3="1"
          k4="0"
          result="finalBloom"
        ></feComposite>
        <feComposite
          in="finalBloom"
          in2="blurredBloom2"
          operator="arithmetic"
          k1="0"
          k2="1"
          k3="1"
          k4="0"
        ></feComposite>
      </filter>
    </defs>
  </svg>

  <!-- Text area for input -->
  <textarea
    id="textInput"
    class="textarea"
    rows="4"
    placeholder="Type something here..."
  ></textarea>

  <!-- Display area with animated letters -->
  <div id="textDisplay" class="text-display"></div>
</div>
              
            
!

CSS

              
                /* Container styling */
.container {
  width: 100%;
  background-color: #000;
  border: 1px solid #000;
  padding: 8rem 4rem; /* py-32 px-16 */
  border-radius: 0.375rem; /* rounded-md */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem; /* gap-4 */
  margin-bottom: 13rem; /* mb-52 */
  font-family:sans-serif;
}

/* Textarea styling */
.textarea {
  width: 20rem; /* w-80 */
  height: 3rem; /* h-12 */
  padding: 0.5rem; /* p-2 */
  background-color: #171717; /* bg-neutral-950 */
  color: white;
  border: 1px solid #404040; /* border-neutral-700 */
  outline: none;
  resize: none;
  transition: all 0.5s ease;
  border-radius: 0.375rem; /* rounded-md */
}

.textarea:focus {
  box-shadow: 0 0 0 1px #67e8f9; /* focus:ring-cyan-300 */
}

/* Text display styling */
.text-display {
  margin-top: 1rem; /* mt-4 */
  color: white;
  font-size: 1.25rem; /* text-xl */
  display: flex;
  flex-wrap: wrap;
  height: 13rem; /* h-52 */
  align-content: flex-start;
  justify-items: flex-start;
  width: 100%;
  filter: url(#bloom-filter);
}

/* Animated text styling */
.animated-text {
  font-weight: 600; /* font-semibold */
  font-size: 2.25rem; /* text-4xl */
  color: #06b6d4; /* text-cyan-500 */
  animation: colorChange 0.7s ease-in forwards;
}

/* Keyframe animation for text color */
@keyframes colorChange {
  from {
    color: white;
  }
  to {
    color: #06b6d4; /* text-cyan-500 */
  }
}
              
            
!

JS

              
                document.addEventListener('DOMContentLoaded', () => {
  const textInput = document.getElementById('textInput');
  const textDisplay = document.getElementById('textDisplay');
  let currentText = ''; // Tracks the text currently in the display

  textInput.addEventListener('input', () => {
    const newText = textInput.value;

    // Find the length of the common prefix between currentText and newText
    let i = 0;
    while (
      i < currentText.length &&
      i < newText.length &&
      currentText[i] === newText[i]
    ) {
      i++;
    }

    // Remove spans from the end if the new text is shorter
    while (textDisplay.children.length > i) {
      textDisplay.removeChild(textDisplay.lastChild);
    }

    // Add new spans for characters added to the input
    for (let j = i; j < newText.length; j++) {
      const span = document.createElement('span');
      span.className = 'animated-text'; // Optional: for styling or animation
      span.textContent = newText[j] === ' ' ? '\u00A0' : newText[j]; // Handle spaces
      textDisplay.appendChild(span);
    }

    // Update the current text to match the new input
    currentText = newText;
  });
});
              
            
!
999px

Console