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.

+ 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.


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.


                <!-- See the Moon's shadow on Earth's surface. -->

Made with LUME.
<script src=""></script>

<!-- Polyfill for Pointer Events (boo Safari) -->
<script src=""></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-camera-rig align-point="0.5 0.5 0.5" initial-polar-angle="0" min-distance="90" max-distance="1000" initial-distance="500"></lume-camera-rig>

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

	<!-- Sun light -->
	<lume-node align-point="0.5 0.5" size="0 0" rotation="0 -50 0">
		<lume-node align-point="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>

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

		<lume-node rotation="0 180 0">
			<lume-sphere id="earth" texture="//" bump-map="//" specular-map="//" size="120 120 120" mount-point="0.5 0.5 0.5" align-point="0.5 0.5" color="white">
				<lume-sphere id="clouds" texture="//" opacity="0.7" size="125 125 125" align-point="0.5 0.5 0.5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>

		<lume-node align-point="0.5 0.5" rotation="90 10 0">
			<lume-node id="moonRotator" align-point="0.5 0.5" rotation="0 0 110">
				<lume-sphere texture="//" position="250" size="5 5 5" mount-point="0.5 0.5 0.5" color="white"></lume-sphere>



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;




// We wrote the rotation function this way so that it would always start
// at the angle defined in the HTML.
let lastTime =;
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 some 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];