cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              *{
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

canvas{
  background: #382854;
  display: block;
  height: 100vh;
  width: 100vw;
}
            
          
!
            
              (function(){
 
	//Renderer
  let renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
  renderer.setSize( window.innerWidth, window.innerHeight );
  document.body.appendChild( renderer.domElement );
  
	//Scene
	let scene = new THREE.Scene();

	//Camera
  let camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 1000 );
	camera.position.set(280, 200, 0);
	camera.lookAt( new THREE.Vector3(0,0,0) );

  //Mesh
  let mesh;
  const meshUrl = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1678849/room.js';
  const textureUrl = 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1678849/map.jpg';
  const texture = new THREE.TextureLoader().load( textureUrl );
  texture.anisotropy = 8; // Mmm Crisp Textures
  const material = new THREE.MeshBasicMaterial( { map: texture } );
  const MeshLoader = new THREE.JSONLoader().load( meshUrl, ( geometry ) => {
    mesh = new THREE.Mesh( geometry, material );
    scene.add( mesh );
  });

	//Light - Set to white because lighting and shadows are already baked into the texture
	const ambientLight = new THREE.AmbientLight( 0xffffff );
	scene.add( ambientLight );

	//Render
	function render() {
		requestAnimationFrame( render );
    if( mesh ){
      mesh.rotation.y += 0.005; //Less Dizzying Jason?
    }
		renderer.render( scene, camera );
	}

	render();

})();

            
          
!
999px
Loading ..................

Console