Pen Settings



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


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


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.


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.


                <h1>Room finished</h1>



                body {
  max-width: 100%;
/* feel free to style the canvas any way you want. If you want it to
      use the entire window, set width: 100% and height: 100%. */

canvas {
  width: 80%;
  height: 500px;
  display: block;
  margin: 10px auto;



                var scene = new THREE.Scene(); 

var renderer = new THREE.WebGLRenderer();


// create a box that will be turned into a room
var roomGeom = new THREE.BoxGeometry(100,100,100);

// create an array of 6 Lambert materials from an array of colors for the inner 
// faces of the box
var materialArray = [];
var faceColors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF, 0xFF00FF];
for(var i = 0; i < 6; i++) {
    materialArray.push(new THREE.MeshLambertMaterial({
                                 color: faceColors[i],
                                 side: THREE.BackSide}));

// create mesh face material and a room mesh, and add the mesh to the scene
var roomMaterial = new THREE.MeshFaceMaterial(materialArray);
var roomMesh = new THREE.Mesh(roomGeom, roomMaterial);

// add a white point light source in the center of the room
var light = new THREE.PointLight(0xFFFFFF, 2, 0);


// displayView() maps an image texture onto a plane, places it at the
// location of the back face (wall) of the room, and renders the scene
function displayView (texture) {
    var planeGeom = new THREE.PlaneGeometry(100,100);
    var planeMat = new THREE.MeshLambertMaterial( {color: 0xffffff,
                                                 map: texture} );
    var planeMesh = new THREE.Mesh(planeGeom, planeMat);

// create a texture loader to load the image of the ocean scene
var loader = new THREE.TextureLoader();

            function (texture) {
            } );

var state = TW.cameraSetup(renderer,
                           {minx: -50, maxx: 50,
                            miny: -50, maxy: 50,
                            minz: -50, maxz: 50});