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

              
                p Shout shout let it all out!
h1.animate AAAAAAAARRRRGH!!!!

p.error I need access to the microphone
              
            
!

CSS

              
                @import url('https://rsms.me/inter/inter.css');
* {
  font-family: Inter, Helvetica, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  height: 100vh;
  background: #010101;
  color: white;
  &::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, black, transparent 15%, transparent 85%, black);
  }
}

h1 {
  font-family: 'Inter var', sans-serif;
  font-size: calc(100vw / 24 * 2);
  transition: 0.15s;
  margin: 0;
  word-break: break-all;
  font-weight: var(--font-weight);
  font-variation-settings: 'wght' var(--font-weight);
  text-align: center;
}

.error {
  display: none;
  &.show {
    display: block;
  }
}
              
            
!

JS

              
                // https://stackoverflow.com/questions/33322681/checking-microphone-volume-in-javascript
navigator.mediaDevices
  .getUserMedia({ audio: true })
  .then(function (stream) {
    // let audioContext = new AudioContext();
    let AudioContext =
      window.AudioContext || // Default
      window.webkitAudioContext || // Safari and old versions of Chrome
      false;

    if (AudioContext) {
      // Do whatever you want using the Web Audio API
      audioContext = new AudioContext();
      // ...
    } else {
      // Web Audio API is not supported
      // Alert the user
      alert(
        "Sorry, but the Web Audio API is not supported by your browser. Please, consider upgrading to the latest version or downloading Google Chrome or Mozilla Firefox"
      );
    }
    let analyser = audioContext.createAnalyser();
    let microphone = audioContext.createMediaStreamSource(stream);
    let javascriptNode = audioContext.createScriptProcessor(2048, 1, 1);

    analyser.smoothingTimeConstant = 0.8;
    analyser.fftSize = 1024;

    microphone.connect(analyser);
    analyser.connect(javascriptNode);
    javascriptNode.connect(audioContext.destination);

    javascriptNode.onaudioprocess = function () {
      var array = new Uint8Array(analyser.frequencyBinCount);
      analyser.getByteFrequencyData(array);
      var values = 0;

      var length = array.length;
      for (var i = 0; i < length; i++) {
        values += array[i];
      }

      var average = values / length;
      document
        .querySelector(".animate")
        .style.setProperty("--font-weight", (average / 100) * 900);
    };
  })
  .catch(function (err) {
    document.querySelector(".error").classList.add("show");
    console.log(err);
  });

              
            
!
999px

Console