Pen Settings

HTML

CSS

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.

+ 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

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.

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

              
                <!-- Do you see the Moon's shadow on Earth's surface when it passes in front of the sun? -->

<!-- Forked from example at:
https://codepen.io/trusktr/pen/dypwZNP -->

<!--
Made with LUME.
http://github.com/lume/lume
-->
<script src="https://assets.codepen.io/191583/LUME.unversioned.3.js"></script>

<!-- By default a <lume-scene> fills the space of it's parent, in this case the <body>. -->
<lume-scene id="scene" webgl touch-action="none">
	<lume-node id="orbit" size-mode="proportional proportional" size="1 1" scale="2 2 2">

		<!-- Stars -->
		<lume-sphere id="stars" texture="//assets.codepen.io/191583/galaxy_starfield.png" receive-shadow="false" has="basic-material" sidedness="back" size="4000 4000 4000" align="0.5 0.5 0.5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>

		<!-- Sun light -->
		<lume-node align="0.5 0.5" size="0 0" rotation="0 -50 0">
			<lume-node align="0.5 0.5" size="0 0" rotation="10 0 0">
				<lume-point-light id="light" size="0 0" position="0 0 1800" color="white" intensity="2" distance="10000" shadow-map-width="2048" shadow-map-height="2048" shadow-camera-far="20000"></lume-point-light>
			</lume-node>
		</lume-node>

		<!-- Earth -->
		<lume-node align="0.5 0.5" size="0 0 0">

			<lume-node rotation="0 180 0">
				<!-- Original textures -->
				<!---
				<lume-sphere id="earth" texture="//assets.codepen.io/191583/earthmap1k.jpg" bump-map="//assets.codepen.io/191583/earthbump1k.jpg" specular-map="//assets.codepen.io/191583/earthspec1k.jpg" size="120 120 120" mount-point="0.5 0.5 0.5" align="0.5 0.5" color="white">

				<lume-sphere id="clouds" texture="//assets.codepen.io/191583/earthclouds.png" opacity="0.7" size="125 125 125" align="0.5 0.5 0.5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>
				</lume-sphere>

				-->
				<lume-sphere id="earth" texture="https://i.imgur.com/MBvuAsF.png" bump-map="" specular-map="" size="120 120 120" mount-point="0.5 0.5 0.5" align="0.5 0.5" color="white">

					<lume-sphere id="clouds" texture="" opacity="0.1" size="125 125 125" align="0.5 0.5 0.5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>
				</lume-sphere>

			</lume-node>

			<lume-node align="0.5 0.5" rotation="90 10 0">
				<lume-node id="moonRotator" align="0.5 0.5" rotation="0 0 110">
					<lume-sphere texture="//assets.codepen.io/191583/moon.jpg" position="250" size="5 5 5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>
				</lume-node>
			</lume-node>

		</lume-node>

	</lume-node>
</lume-scene>
              
            
!

CSS

              
                html,
body {
	background: #222;
	width: 100%;
	height: 100%;
	margin: 0;
}

lume-scene {
	/* Prevent touch scrolling from interfering with out pointermove handler. */
	touch-action: none;
}

lume-scene * {
	pointer-events: none;
}

              
            
!

JS

              
                // // I'm gonna comment this out for now, because it lags my codepen.io page when it tries to load a preivew

// {
// 	// Define LUME's HTML elements with their default names.
// 	LUME.useDefaultNames();

// 	// We wrote the rotation function this way so that it would always start
// 	// at the angle defined in the HTML.
// 	let lastTime = performance.now();
// 	let dt = 0;
// 	moonRotator.rotation = (x, y, z, time) => {
// 		dt = time - lastTime;
// 		lastTime = time;
// 		return [x, y, z + dt * 0.01];
// 	};

// 	// We could've written it more simply but it would start at an angle
// 	// based on time instead of our preferred angle:
// 	// moonRotator.rotation = (x, y, z, t) => [x, y, t * 0.004];

// 	earth.rotation = (x, y, z, t) => [x, t * 0.01, z];
// 	clouds.rotation = (x, y, z, t) => [x, -t * 0.003, z];

// 	// Add some interaction: drag to rotate the view:
// 	scene.addEventListener("pointerdown", () => {
// 		// Stop rotation if any.
// 		orbit.rotation = () => false;

// 		let delta = 0;

// 		const onMove = (event) => {
// 			delta = event.movementX * 0.2;
// 			orbit.rotation.y += delta;
// 		};

// 		scene.addEventListener("pointermove", onMove);

// 		scene.addEventListener(
// 			"pointerup",
// 			() => {
// 				// stop dragging
// 				scene.removeEventListener("pointermove", onMove);

// 				if (delta === 0) return;

// 				// slow the rotation down based on former drag speed
// 				orbit.rotation = (x, y, z) => {
// 					delta = delta * 0.95;

// 					// stop rotation once the delta is small enough that we
// 					// no longer notice the rotation.
// 					if (Math.abs(delta) < 0.1) return false;

// 					return [x, y + delta, z];
// 				};
// 			},
// 			{ once: true }
// 		);
// 	});
// }

              
            
!
999px

Console