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>Triangle interpolation</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: 400px;
          display: block;
          margin: 10px auto;

  <h1>Triangle interpolation</h1>
  <p>Demo of an RGB triangle automatically interpolated by WebGL.






                var scene = new THREE.Scene();

// construct geometry for a triangle with three different vertex colors
var vertexA = new THREE.Vector3(0, 0, 0);
var colorA = new THREE.Color( );

var vertexB = new THREE.Vector3(1, 0, 0);
var colorB = new THREE.Color( THREE.ColorKeywords.lime );

var vertexC = new THREE.Vector3(0.5, 1, 0);
var colorC = new THREE.Color( );

var triGeom = new THREE.Geometry();
triGeom.vertices = [ vertexA, vertexB, vertexC ];
triGeom.faces = [ new THREE.Face3(0, 1, 2) ];
// set of possible colors for the vertices
triGeom.vertexColors = [ colorA, colorB, colorC ];

// set particular vertexColors for the individual face

// create a material that uses the vertex colors to compute face color
var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.VertexColors } );

var mesh = new THREE.Mesh( triGeom, material );


// ================================================================
var renderer = new THREE.WebGLRenderer();


               {minx: 0, maxx: 1,
                miny: 0, maxy: 1,
                minz: 0, maxz: 0});