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.

+ add another resource


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


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.


                <canvas id="renderCanvas" touch-action="none"></canvas>


canvas {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;



                // Get the Canvas element from our HTML below
var canvas = document.getElementById("renderCanvas");

// Load BABYLON 3D engine and set the root directory
var engine = new BABYLON.Engine(canvas, true);

// Create a new scene with a camera (mandatory)
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera("camera", 0, 0, 10, new BABYLON.Vector3(0, 0, 0), scene);
camera.attachControl(canvas, true);

// Add WebVR button 
var vrHelper = scene.createDefaultVRExperience({createDeviceOrientationCamera:false});

// Creating a omnidirectional light
var light0 = new BABYLON.PointLight("Omni", new BABYLON.Vector3(0, 0, 10), scene);

// Creating a sphere of size 5, at 0,0,0
var sphere = BABYLON.Mesh.CreateSphere("origin", 8, 5.0, scene);

// Creating a box of size 4, 
var box = new BABYLON.Mesh.CreateBox('mesh', 4, scene);

// Position the box and sphere
box.position.y = -10;
box.position.z = -5;
sphere.position.x = 0;
sphere.position.y = -5;
sphere.position.z = 3;

// Show the bounding box
box.showBoundingBox = true;

// Add a material color to the box
var material = new BABYLON.StandardMaterial('std', scene);
material.diffuseColor = new BABYLON.Color3(0.7, 0, 0.2);

box.material = material;

// Add a material color to the sphere
var material2= new BABYLON.StandardMaterial('std', scene);
material2.diffuseColor = new BABYLON.Color3(.1, 0.1, 0.9);
sphere.material = material2; 

// Attach the camera to the scene

// Add animation to the objects
var counter = 0;

// Once the scene is loaded, just register a render loop to render it, animation controls can be added here as well
engine.runRenderLoop(function () {
  counter += 0.1;
  box.rotation.x += 0.01;
  box.rotation.y += 0.01;
  box.rotation.z += 0.01;
  sphere.position.x += 0.03;