Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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.




                html, body {
  margin: 0;
  width: 100%;
  height: 100%;
canvas {
  width: 100%;
  height: 100%;



                function main() {
  const canvasWidth = window.innerWidth;
  const canvasHeight = window.innerHeight;

  const fov = 75; // Grados
  const aspect = window.innerWidth / window.innerHeight; // Relación de aspecto
  const near = 0.1; // Si el objeto está más cerca que esta distancia no se renderiza
  const far = 5; // Si el objeto está más lejos que esta distancia no se renderiza

  const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);

  camera.position.z = 2;

  // Create a renderer with Antialiasing
  const renderer = new THREE.WebGLRenderer({ antialias: true });

  // Configure renderer size
  renderer.setSize(window.innerWidth, window.innerHeight);

  // Append Renderer to DOM

  const scene = new THREE.Scene();

  const boxWidth = 1;
  const boxHeight = 1;
  const boxDepth = 1;

  const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);
  const material = new THREE.MeshPhongMaterial({ color: 0x44aa88 });

  const cube = new THREE.Mesh(geometry, material);

  const color = 0xffffff;
  const intensity = 1;
  const light = new THREE.DirectionalLight(color, intensity);
  light.position.set(-1, 2, 4);

  renderer.render(scene, camera);

  function render(time) {
    time *= 0.001; 

    cube.rotation.x = time;
    cube.rotation.y = time;

    renderer.render(scene, camera);