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.


<!doctype html>
    <title>Steeple keyboard adjustment starter</title>
      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;

  <h1>Steeple keyboard adjustment starter</h1>
  <p>Start from this pen for the steeple adjustment via keyboard controls exercise.</p>






                /* Returns a geometry object for a steeple, which is just a square pyramid
 * or tetrahedron.  The origin is in the center of the base, so the base
 * vertices are at y=0 and x and z at plus or minus half the width, and
 * the top is at (0,height,0) */

function createSteeple(width, height) {
    var geom = new THREE.Geometry();
    var w2 = 0.5*width;
    // add the base
    geom.vertices.push(new THREE.Vector3(+w2, 0, +w2));
    geom.vertices.push(new THREE.Vector3(+w2, 0, -w2));
    geom.vertices.push(new THREE.Vector3(-w2, 0, -w2));
    geom.vertices.push(new THREE.Vector3(-w2, 0, +w2));
    geom.vertices.push(new THREE.Vector3(0, height, 0));

    // now that we've got the vertices we need to define the faces.
    // base
    geom.faces.push(new THREE.Face3(0, 1, 2));
    geom.faces.push(new THREE.Face3(0, 2, 3));

    // side faces
    geom.faces.push(new THREE.Face3(0, 1, 4));
    geom.faces.push(new THREE.Face3(1, 2, 4));
    geom.faces.push(new THREE.Face3(2, 3, 4));
    geom.faces.push(new THREE.Face3(3, 0, 4));

    // calculate the normals for shading

    return geom;

// We always need a scene.
var scene = new THREE.Scene();

// ====================================================================

var barnWidth = 50;
var barnHeight = 30;
var barnDepth = 40;

var barn1geom = TW.createBarn( barnWidth, barnHeight, barnDepth );
var barn1mesh = TW.createMesh(barn1geom);

// ================================================================

var steepleHeight = 36;
var steepleWidth = 6;
var steepleMesh;

function placeSteeple(steepleHeight,steepleWidth) {
    var half = steepleWidth * 0.5;
    var steepleGeom = createSteeple(steepleWidth,steepleHeight);
    steepleMesh = TW.createMesh(steepleGeom);

placeSteeple(steepleHeight, steepleWidth);

// ================================================================

var renderer = new THREE.WebGLRenderer();

TW.mainInit(renderer, scene);

               {minx: 0, maxx: barnWidth,
                miny: 0, maxy: barnHeight + barnWidth*0.5+steepleHeight-steepleWidth*0.5,
                minz: -barnDepth, maxz: 0});

// add new code here