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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <canvas id="glcanvas"></canvas>

<div class="blink"></div>
              
            
!

CSS

              
                body {
  margin: 0;
  padding: 0;
  overflow: hidden; 
}

.blink {
  background-color: grey;
  opacity: 1;
  display: inline-block;
  left: 10px;
  top: 10px;
  position: absolute;
  width: 16px;
  height: 16px;
  float: left;
  border-radius: 6px;
  z-index: 9001; }

              
            
!

JS

              
                /*
* Example: Mixing a webcam with gif or video
* https://virtualmixproject.com/docs/reference/Addon_AudioAnalysis.html
*
* Give it ~20-30 seconds to calibrate, the blinking dot will turn red, yellow or white
* depending on the confidence of the analyser. You should hear a 140 bpm metronome
*
* click on the video if you hear nothing (might need an action from the user)
* this will also trigger a full screen event. don't ask. press ESC
*
* try the other mp3s as well :)
*/

var renderer = new GlRenderer();
var video1 = new VideoSource( renderer, { src: 'https://assets.mixkit.co/videos/302/302-720.mp4'} ) // or try with a video as source
var gif1 = new GifSource( renderer, { src: 'https://66.media.tumblr.com/acbd87176df36bc9bcf6e9d8abda0cbe/tumblr_pcsgcsmIeB1qeyvpto1_500.gif'})
var mixer1 = new Mixer( renderer, { source1: gif1, source2: video1 });
var output = new Output( renderer, mixer1 )
var analysis1 = new AudioAnalysis( renderer, { audio: 'https://virtualmixproject.com/nocorsaudio/140_metronome.mp3' } ); 

// var analysis1 = new AudioAnalysis( renderer, { audio: 'https://virtualmixproject.com/nocorsaudio/100_metronome.mp3' } );
// var analysis1 = new AudioAnalysis( renderer, { audio: 'https://virtualmixproject.com/nocorsaudio/fear_is_the_mind_killer_audio.mp3' } );
// var analysis1 = new AudioAnalysis( renderer, { audio: 'https://virtualmixproject.com/nocorsaudio/fulke_absurd.mp3' } );
// var analysis1 = new AudioAnalysis( renderer, { audio: 'https://virtualmixproject.com/nocorsaudio/rage_hard.mp3' } );

renderer.init();
renderer.render();

mixer1.mixMode(2) // hard-switch
analysis1.add(mixer1.pod) // add mixer' pod to bpm analysis

// check the analysis data through console.log( analysis1.tempoData )
/*
  bpm: 100                      // the bpm measured
  calibrating: true             // is calibrating?
  confidence: "calibrating"     // confidence: calibrating, average, good
  foundpeaks: [ .. ]            // peaks above the treshold
  peaks: [ .. ]                 // peak container
  tempoCounts: [ .. ]           // ordered counts of temp and frequency
  treshold: 1                   // treshold for peaks
*/

// switch audio off, without switching sampler off
// analysis1.disconnectOutput()
// analysis1.connectOutput()

// get to audio element through .audio
// NOTE: if you put the volume to 0, measurements will stop (gives warnings)
// analysis1.audio
              
            
!
999px

Console