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

              
                <html>
	<head>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<title>[The Thing]</title>
		<style>
			body {
				margin: 0px;
    			overflow: hidden; 
    			background-color: #ffffff;
    			font-family: 'Arial';
    		}
			
			#help{
				position: absolute;
			    top: 1%;
			    left: 1%;
			    font-size: 20px;
			    color: white;
			}

		</style>
	</head>
	<body>
		<div id="help">[The Thing] - orbit around it</div>
	</body>
</html>
              
            
!

CSS

              
                /*orbit around it*/
              
            
!

JS

              
                //Created by XORXOR 2016
var container;

var camera, controls, scene, renderer;
var resolution,numBlobs,effect;

var obj,mirrorCamera;

var mat;
var time = 0;
var clock = new THREE.Clock();
var object;

var pointLight;

var uniforms;

var azimuth = 0.1843;
var inclination = .4877;

init();
animate()

function initSky() {

    // Add Sky Mesh
    sky = new THREE.Sky();
    scene.add( sky.mesh );

    // Add Sun Helper
    sunSphere = new THREE.Mesh(
        new THREE.SphereBufferGeometry( 20000, 16, 8 ),
        new THREE.MeshBasicMaterial( { color: 0xffffff } )
    );
    sunSphere.position.y = - 42000;
    sunSphere.visible = false;
    scene.add( sunSphere );

    uniforms = sky.uniforms;
    uniforms.turbidity.value = 12;
    uniforms.rayleigh.value =  .737;
    uniforms.luminance.value = 1.1;
    uniforms.mieCoefficient.value = 0.043;
    uniforms.mieDirectionalG.value = 0.824;

    moveSun();

}

function moveSun(){
    var distance = 4000;
    azimuth= (Math.cos(time*.1)+1)*.25;
    inclination = (Math.sin(time*.1)+1)*.25;

    var theta = Math.PI * ( inclination - 0.5 );
    var phi = 2 * Math.PI * (azimuth - 0.5 );

    sunSphere.position.x = distance * Math.cos( phi );
    sunSphere.position.y = distance * Math.sin( phi ) * Math.sin( theta );
    sunSphere.position.z = distance * Math.sin( phi ) * Math.cos( theta );

    sky.uniforms.sunPosition.value.copy( sunSphere.position );
}



function init() {

    camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, .1, 20000 );
    camera.position.set( -86, 5.2, 0 );
    scene = new THREE.Scene();

    renderer = new THREE.WebGLRenderer();
    renderer.setPixelRatio( window.devicePixelRatio );
    renderer.setSize( window.innerWidth, window.innerHeight );
    renderer.setClearColor(0xdce2d6);
    //
    renderer.gammaInput = true;
    renderer.gammaOutput = true;
    
    document.body.appendChild( renderer.domElement );

    //STUFF
    initSky();
    //env
    var radius = 500;
    
    mirrorCamera = new THREE.CubeCamera( 0.1, 5000, 1024 );
    mirrorCamera.renderTarget.texture.minFilter = THREE.LinearMipMapLinearFilter;
    scene.add( mirrorCamera );
    
    // MARCHING CUBES
    mat = new THREE.MeshBasicMaterial( { envMap: mirrorCamera.renderTarget.texture,fog:true,shading: THREE.SmoothShading});
    resolution = 32;
    numBlobs = 15;

    effect = new THREE.MarchingCubes( resolution, mat, true, true );
    effect.position.set( 0, 0, 0 );
    effect.scale.set( 60, 60, 60 );

    effect.enableUvs = false;
    effect.enableColors = false;

    scene.add( effect );
   
    controls = new THREE.OrbitControls( camera, renderer.domElement );
    controls.maxDistance = 170;
    controls.minDistance = 85

    window.addEventListener( 'resize', onWindowResize, false );
}

function animate() {
    effect.visible = false; 
    mirrorCamera.updateCubeMap( renderer, scene );
    effect.visible = true; 
    
    var delta = clock.getDelta();
    time += delta  * 0.5;
    moveSun();

    updateCubes( effect, time, numBlobs, true );

    requestAnimationFrame(animate);
    renderer.render(scene, camera);
}

function updateCubes( object, time, numblobs, floor, wallx, wallz ) {

    object.reset();

    // fill the field with some metaballs

    var i, ballx, bally, ballz, subtract, strength;

    subtract = 12;
    strength = .6 / ( ( Math.sqrt( numblobs ) - 1 ) / 4 + 1 );
    var radius = resolution * Math.sqrt( strength / subtract );
    

    var r = .25;
    for ( i = 0; i < numblobs; i ++ ) {
        noise.seed(time+100)
        
        rotA =  Math.log(i)*time * 0.92352;
        rotV =  noise.perlin2(i,time) *3.42322;
        ballx = r*(Math.sin( rotA )*Math.cos( rotV))
        ballz = r*(Math.sin( rotA ) *Math.sin( rotV))
        bally = r*(Math.cos( rotA ))

        object.addBall(ballx+.5, bally+.5, ballz+.5, strength, subtract);
    }
    //add bigball
    object.addBall(.5,.5,.5,6,6)
}

radians = function(degrees) {
    return degrees * Math.PI / 180;
};

function onWindowResize() {
    camera.left = window.innerWidth / - 2;
    camera.right = window.innerWidth / 2;
    camera.top = window.innerHeight / 2;
    camera.bottom = window.innerHeight / - 2;
    camera.updateProjectionMatrix();
    renderer.setSize( window.innerWidth, window.innerHeight );
}

              
            
!
999px

Console