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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              var camera, scene, renderer, controls;

init();
animate();

function init()
{	
    // basic scene
    renderer = new THREE.WebGLRenderer( {antialias:true} );
	var width = window.innerWidth;
	var height = window.innerHeight;

    renderer.setSize (width, height);
    
	document.body.appendChild (renderer.domElement);

	scene = new THREE.Scene();

	camera = new THREE.PerspectiveCamera (45, width/height, 1, 10000);
	camera.position.y = 16;
	camera.position.z = 350;

    controls = new THREE.OrbitControls (camera, renderer.domElement);
    controls.rotateSpeed = 0.3;
    controls.enableDamping = true;
	controls.dampingFactor = 0.25;

    var loader = new THREE.TextureLoader();
    loader.crossOrigin = '';
    var texture = loader.load('https://2.bp.blogspot.com/-Jfw4jY6vBWM/UkbwZhdKxuI/AAAAAAAAK94/QTmtnuDFlC8/s1600/2_no_clouds_4k.jpg' );
    
    // globe
    var material = new THREE.MeshPhongMaterial( {
        color: 0xffffff,
        map: texture,
       	displacementMap: texture,
        displacementScale: 10
    } );
    
    var sphere = new THREE.Mesh( new THREE.SphereGeometry( 100, 32, 32 ), material );
    scene.add( sphere );
    
    var al = new THREE.AmbientLight( 0x444444 );
    scene.add( al );
    
    var dl = new THREE.DirectionalLight( 0xffffff, 1 );
    scene.add( dl );
    dl.position.set( 1, 1, 1.6 );
    
}

function animate() {
    controls.update();
 	requestAnimationFrame( animate );
    renderer.render( scene, camera );
}
            
          
!
999px
Loading ..................

Console