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

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.

HTML

              
                <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/build/three.min.js"></script>

<!--
Three.js ist eine JavaScript-Bibliothek zur Erstellung von interaktiven 3D-Grafiken im Webbrowser. Dokumentation von Three.js: https://threejs.org/docs/
--!>
              
            
!

CSS

              
                body {
  margin: 0;
  background-color: black;
}
canvas {
  display: block;
}

              
            
!

JS

              
                // Erstelle eine Szene, eine Kamera und einen Renderer
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
  75,
  window.innerWidth / window.innerHeight,
  0.1,
  1000
);
var renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

// Erstelle ein Würfelobjekt mit verschiedenen Farben für jede Seite
var cubeGeometry = new THREE.BoxGeometry();
var cubeMaterials = [
  new THREE.MeshBasicMaterial({ color: 0x3399ff }),
  new THREE.MeshBasicMaterial({ color: 0x3399ff }),
  // Vor- und Rückseite
  new THREE.MeshBasicMaterial({ color: 0x555555 }),
  new THREE.MeshBasicMaterial({ color: 0x555555 }),
  // Ober- und Unterseite
  new THREE.MeshBasicMaterial({ color: 0xffffff }),
  new THREE.MeshBasicMaterial({ color: 0xffffff })
  // Linke und rechte Seite
];
var cube = new THREE.Mesh(cubeGeometry, cubeMaterials);
scene.add(cube);

// Positioniere die Kamera (Nähe)
camera.position.z = 2;

function animate() {
  requestAnimationFrame(animate);
  cube.rotation.x += 0.01;
  cube.rotation.y += 0.01;
  renderer.render(scene, camera);
}
animate();

              
            
!
999px

Console