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.




                body { 
  margin: 1; 
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(to bottom, #CDA49D, #e7d3d0);

    display: block;
    margin: 0 auto;


                //following the tuto
//set the scene
var scene = new THREE.Scene();
//add a camera
var camera = new THREE.PerspectiveCamera( 70, window.innerWidth/window.innerHeight, 0.1, 1000 );
// add a renderer
var renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

//add geometry
//create new 
var geometry = new THREE.BoxGeometry( 2, 2, 2); 
var color = new THREE.Color("#282130"); // set the color of the material
var material = new THREE.MeshStandardMaterial ( {color: color.getHex(), wireframe: false} ); // create a material
//add the geometry to the mesh, and apply the material to it
var cube = new THREE.Mesh( geometry, material );
scene.add( cube )

var geometry = new THREE.BoxGeometry( 4, 4, 4);
var material = new THREE.MeshBasicMaterial( {
 color: "", wireframe: true, transparent: true
var wireframeCube = new THREE.Mesh ( geometry, material )
scene.add( wireframeCube )

camera.position.z = 7;

//add point light
var pointLight = new THREE.PointLight( 0xffffff, 1 );
pointLight.position.set( 25, 50, 25 );
scene.add( pointLight );

//add ambient light
var ambientLight = new THREE.AmbientLight(0xffffff, 0.5); //soft white light(color,intensity)

//render loop
var render = function () {
  requestAnimationFrame( render );

  //add the geometry to the renderer
  cube.rotation.x += 0.04; 
  cube.rotation.y += 0.04;
  wireframeCube.rotation.x += 0.01;
  wireframeCube.rotation.y += 0.01;

  renderer.render(scene, camera);