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

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

CSS

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


              
            
!

JS

              
                /*
* Example: Mixing a Gampad with four video sources
* https://virtualmixproject.com/docs/reference/index.html
* https://virtualmixproject.com/docs/reference/Controller_GamePadController.html
* 
* If all went well, you should be able to fade four videos together with your
* left handle. If you do nothing all videos will be shown, move around each video
* is 'in the corner', so to speak.
*/

var renderer = new GlRenderer();

var video1 = new VideoSource( renderer, { src: 'https://assets.mixkit.co/videos/302/302-720.mp4'} )
var video2 = new VideoSource( renderer, { src: 'https://assets.mixkit.co/videos/348/348-720.mp4'} )
var video3 = new VideoSource( renderer, { src: 'https://assets.mixkit.co/videos/344/344-720.mp4'} )
var video4 = new VideoSource( renderer, { src: 'https://assets.mixkit.co/videos/351/351-720.mp4'} )

var mixer1 = new Mixer( renderer, { source1: video1, source2: video2 });
var mixer2 = new Mixer( renderer, { source1: video3, source2: video4 });
var mixer3 = new Mixer( renderer, { source1: mixer1, source2: mixer2 });

var gamepad1 = new GamePadController( renderer )

var output = new Output( renderer, mixer3 )

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

// ------------------------------------------------------------

// change this to select gamepad, if multiple devices can identify as gamepad
// 0, 1, 2 etc.
// look for the index in the console log; like this:
// Gamepad connected at index 2: Xbox 360 Controller (XInput STANDARD GAMEPAD). 17 buttons, 4 axes.
// VM743 console_runner-1df7d3399bdc1f40995a35209755dcfd8c7547da127f6469fd81e5fba982f6af.js:1 init GamePadController
// the gamepad_index is then 2
gamepad1.gamepad_index = 0

var left_x = function( arr ) {
  mixer1.pod( ( arr[1] + 1 ) / 2 )
  mixer2.pod( ( arr[1] + 1 ) / 2 )  
}

var left_y = function( arr ) {
  mixer3.pod( ( arr[1] + 1 ) / 2 )  
}

gamepad1.addEventListener( 100, left_x )
gamepad1.addEventListener( 101, left_y )

              
            
!
999px

Console