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.


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="canvasID"></canvas>
<div id="instructions">
  <p>Click+Drag to rotate<br>Scroll to zoom</p>


                body {
  overflow: hidden;
  margin: 0;
#instructions {
  color: white;
  padding-left: 20px;
  position: absolute;
  top: 0;
  width: 100%;
  text-align: left;



var count = 8; //length of each side of the big cube. More than 15 really slows down my computer
var space = 4; //space between each cube.

var canvas = document.getElementById("canvasID");
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ canvas: canvas });
renderer.setClearColor( 0x805580, .1);

var rgb_group = new THREE.Object3D();

function init() {
  renderer.setSize( window.innerWidth, window.innerHeight );
  document.body.appendChild( renderer.domElement);
  var color_step = Math.floor(255/count);
  for (var r = 0; r < count; r++) {
        for (var g = 0; g < count; g++) {
            for (var b = 0; b < count; b++) {
              var geo = new THREE.SphereGeometry(1, 50, 50, 0, Math.PI * 2, 0, Math.PI * 2);
              var mat = new THREE.MeshBasicMaterial();
              mat.color.setStyle("rgb(" + r*color_step + "," + g*color_step + "," + b*color_step + ")");
              var mesh = new THREE.Mesh( geo, mat );
              mesh.position.set(r+r*space, g+g*space, b+b*space);
  rgb_group.position.set(-0.5*(count+space*count-2), -0.5*(count+space*count-2), -0.5*(count+space*count-2));
  camera.position.z = count*2+space*count;
  var controls = new THREE.OrbitControls( camera, renderer.domElement );
  controls.enableZoom = true;

// continuously looping
function render() {
  // cool stuff goes here...
  scene.rotation.x += .01;
  scene.rotation.y += .02;
  scene.rotation.z += .001;
  renderer.render(scene, camera);