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>Simple camera not using TW</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: 800px;
      height: 500px;
      display: block;
      margin: 10px auto;


  <h1>Simple camera not using TW</h1>

  <div id="canvasParent"></div>

  <div id="footer">
    <p>&copy; Scott D. Anderson.
      This work is licensed under a <a rel="license" href="">Creative
        Commons License</a>






                var scene = new THREE.Scene();
var renderer = new THREE.WebGLRenderer();
var canvasElt = renderer.domElement;
renderer.setClearColor( 0xdddddd, 1);

// ====================================================================
// Camera setup. See last line of example as well

var camera = new THREE.PerspectiveCamera( 45,      // fovy in degrees
                                          800/500, // aspect ratio: our canvas is 800/500 pixels
                                          1,       // near
                                          100      // far

camera.position.set(10,5,30);   // so that the barn is roughly centered
camera.up.set(0,1,0);           // this is actually the default

// this location is roughly in the center of the front of the barn
var barnFront = new THREE.Vector3(10,5,0); 

camera.lookAt( barnFront );

// This will render the current scene using the current camera
// Invoked at the end of this code.
function render() {
    renderer.render( scene, camera );

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

/* Next, we create objects in our scene. Here, one wire barn. */

var wirebarn = TW.createWireBarn(20,10,40);

// ================================================================
// Gotta do this! Render the scene using the current camera.