Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                
              
            
!

CSS

              
                canvas {
  display: block;
}
              
            
!

JS

              
                const boxes = [[
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,1,1,0,0,0,0,0,0,0,
  0,0,1,1,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,

  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,1,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,1,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,1,1,1,0,0,0,0,0,
  0,0,0,1,1,1,0,0,0,0,0,
  0,0,0,1,1,1,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,

  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0
]];

const size = 1;
const scene = new THREE.Scene();
const renderer = new THREE.WebGLRenderer({
  antialias: true
});
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 100);
const light = new THREE.DirectionalLight(0xFFFFFF);
const geometry = new THREE.BoxGeometry(size, size, size);
const group = new THREE.Group();
let material = new THREE.MeshLambertMaterial({
  color: 0xFFFFFF
});

camera.position.set(size / 2, 0, Math.cbrt(boxes[0].length) * 4);
light.position.set(0, 100, 100);
scene.add(light);

const pivot = new THREE.Group();

group.position.set(-5, -5, -5);

pivot.add(group);
scene.add(pivot);

renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

render();

// window.addEventListener('keydown', (evt) => {
//   setBoxes(boxes[evt.key]);
// });

(() => {
  let i = 0;
  length = 6;
  diff = 1;
  
  setInterval(() => {
    i += diff;
    
    if (i === length - 1) {
      diff = -1;
    } else if (i === 0) {
      diff = 1;
    }
    
    setBoxes(boxes[i]);
  }, 100);
})();

function setBoxes(boxes) {
  resetBoxes();

  for (let i = 0; i < boxes.length; ++i) {
    ((i) => {
      switch (boxes[i]) {
        case 0:
          return;
          break;
        case 1:
          material = new THREE.MeshLambertMaterial({
            color: 0xFFFFFF
          });
          break;
        case 2:
          material = new THREE.MeshLambertMaterial({
            color: 0x888888
          });
          break;
      }

      const cube = new THREE.Mesh(geometry, material);
      const pos = getPosition(i, boxes);

      cube.position.set(
        pos.x * size,
        pos.y * size,
        pos.z * size
      );

      group.add(cube);
    })(i);
  }
}

function resetBoxes() {
  let i = group.children.length;
  
  while(i--) {
    group.remove(group.children[i]);
  }
}

function getPosition(i, boxes) {
  const length = boxes.length;

  const x = i % Math.cbrt(length);
  const y = 0 | i / Math.pow(Math.cbrt(length), 2);
  const z = 0 | i / Math.cbrt(length) % Math.cbrt(length);
  
  return { x, y, z };
}

function render() {
  pivot.rotation.y += .01;
  renderer.render(scene, camera);
  requestAnimationFrame(render);
}
              
            
!
999px

Console