cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

              class SlideWhistle extends HTMLElement {
  constructor() {
  connectedCallback() {
          // create web audio api context
      var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
      // create Oscillator and gain node
      var oscillator = audioCtx.createOscillator();
      var gainNode = audioCtx.createGain();
      // connect oscillator to gain node to speakers
      // We'll set the initial oscillator frequency to 3000 Hertz.
      var initialFreq = 500;
      // We'll set the initial volume to 0.001
      var initialVol = 0.1;
      // and we'll set some options for the oscillator
      oscillator.type = 'triangle';
      oscillator.frequency.value = initialFreq;
      // set options for the gain node
      gainNode.gain.value = initialVol;
      document.addEventListener('mouseenter', function(event){
        gainNode.gain.value = initialVol;
      document.addEventListener('mousemove', function(event){
        oscillator.frequency.value = window.innerHeight - event.y;
      document.addEventListener('mouseout', function(event){
        gainNode.gain.value = 0;

customElements.define('fuckyeah-slidewhistle', SlideWhistle);

Loading ..................