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="renderCanvas"></canvas>
              
            
!

CSS

              
                html,
body {
  overflow: hidden;
  
  margin: 0;
  padding: 0;
  
  width: 100%;
  height: 100%;
}

#renderCanvas {
  width: 100%;
  height: 100%;
	touch-action: none;
  
}
              
            
!

JS

              
                  // Get the canvas element from our HTML above
  let canvas = document.getElementById("renderCanvas");

  // Load the BABYLON 3D engine
  let engine = new BABYLON.Engine(canvas);

// Create a scene
  let createScene = function () {

    // Now create a basic Babylon Scene object 
    let scene = new BABYLON.Scene(engine);

    // Change the scene background color to black.
    scene.clearColor = new BABYLON.Color3(0,0,0);

    // This creates and positions a free camera
    let camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 7, -9), scene);

    // This targets the camera to scene origin
    camera.setTarget(BABYLON.Vector3.Zero());

    // This attaches the camera to the canvas
 camera.attachControl(canvas, false);

    // This creates a light, aiming 0,1,1.5 - to the sky.
    let light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 1.5), scene);

    // Dim the light a small amount
    light.intensity = 0.6;
		
		let cylinder = BABYLON.Mesh.CreateCylinder("cylinder", 3, 3, 3, 6, 1, scene);

    // Move the cylinder  upward 1/2 its height
    cylinder .position.y = 2;
		

    // Let's create built-in 'ground' shape.  Params: name, width, depth, subdivisions, scene
    BABYLON.Mesh.CreateGround("ground", 8, 13, 8, scene);

 
    return scene;

  }; 

 // create a scene
  var scene = createScene();

 // Register a render loop to repeatedly render the scene
  engine.runRenderLoop(function () {
    scene.render();
  });

  // Watch for window resize events
  window.addEventListener("resize", function () {
    engine.resize();
  });
              
            
!
999px

Console