123

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <body>
	<div class="overlay"></div>
	
	<div class="controls">
		<label class="colour-changer-label">Colour</label>
		<input type="color" value="#2EB1B0" class="colour-changer">
		
		<label>Size</label>
		<input type="range" step="0.05" min="0" max="1" class="size-changer">
		
		<label>Rotation</label>
		<input type="range" step="0.05" min="0" max="360" value="0" class="rotation-changer">
		<button class="disco">Disco</button>
	</div>
	
	<svg viewBox="0 250.2 1280.7 299.4" width="100%" height="100%"><path d="M136.3 250.2s45 41.5-20.8 128c-60.2 77.5 13.8 194.4 85.8 167.4 0 0-18.7-22.8-24.2-48.4-10.4-47 12.5-63.7 33.2-80.3 19.4-15.2 49.8-49.1 19.4-97.6 0 0 .7 41.5-56 55.4 0 .7 58.8-98.9-37.4-124.5z"></path><path d="M124.5 540.8S17.9 523.5 33.2 415.6c5.5-42.2-18-56-33.2-65.7 0 0 84.4 2.8 78.2 55.4-9.7 85 28.4 123 46.3 135.5z"></path><g><path d="M388.2 403.8h-37.4v112.1H330V403.8h-37.4v-18.7h96.9l-1.3 18.7zM460.8 518.7c-33.2 0-53.3-21.4-53.3-67.8s20.1-67.8 53.3-67.8c33.2 0 53.3 21.4 53.3 67.8 0 45.6-20.1 67.8-53.3 67.8zm0-118.4c-18 0-31.8 11.1-31.8 49.8s13.8 49.8 31.8 49.8 31.8-11.1 31.8-49.8c0-38-13.8-49.8-31.8-49.8zM618.6 515.9l-27-48.4c-4.2.7-8.3.7-12.5.7h-9v47.7h-20.8V385.1c7.6-1.4 24.2-2.8 38.1-2.8 27 0 49.8 12.5 49.8 42.2 0 20.1-10.4 31.8-27 37.4l30.4 53.3h-22.1v.7zm-31.2-116.2c-5.5 0-12.5.7-17.3 1.4v50.5h10.4c20.1 0 36-6.2 36-26.3 0-19.4-15.2-25.6-29.1-25.6zM750 416.3c-6.9-12.5-15.9-15.9-27.7-15.9-22.1 0-33.2 18.7-33.2 49.8 0 32.5 11.8 49.8 34.6 49.8 9.7 0 18.7-2.1 27-4.8l5.5 15.9c-10.4 4.8-22.8 6.9-33.2 6.9-33.2 0-55.4-19.4-55.4-67.8 0-47.7 24.9-67.8 54.7-67.8 22.8 0 33.2 7.6 41.5 21.4L750 416.3zM871.8 515.9v-58.1H813v58.1h-20.8V385.1H813v54h58.8v-54h20.8v130.8h-20.8zM972.8 515.9c-9.7 0-29.8 0-38.1-.7V385.8c9-2.1 27-3.5 38.1-3.5 24.2 0 46.4 7.6 46.4 33.9 0 12.5-6.2 21.4-14.5 27.7 12.5 5.5 21.4 15.2 21.4 32.5 0 29.1-21.5 39.5-53.3 39.5zm-1.4-116.2c-4.2 0-10.4.7-15.9 1.4v38.1h20.8c3.5 0 6.9 0 10.4.7 8.3-4.8 11.8-12.5 11.8-20.1-.1-16-11.9-20.1-27.1-20.1zm3.5 56h-19.4v43.6c4.8 0 11.8.7 15.9.7 18.7 0 32.5-4.2 32.5-22.1.7-16.7-11-22.2-29-22.2zM1106.3 518.7c-33.2 0-53.3-21.4-53.3-67.8s20.1-67.8 53.3-67.8 53.3 21.4 53.3 67.8c0 45.6-20.1 67.8-53.3 67.8zm0-118.4c-18 0-31.8 11.1-31.8 49.8s13.8 49.8 31.8 49.8 31.8-11.1 31.8-49.8c.1-38-13.8-49.8-31.8-49.8zM1252.3 425.9l-15.2 22.8L1253 473l27.7 42.2h-24.2l-18.7-29.1-11.8-18.7-11.8 18.7-18.7 29.1h-24.9l29.1-42.2 15.2-22.8L1199 426l-26.3-40.8h24.9l18.7 29.1 10.4 16.6 10.4-16.6 18.7-29.1h24.9l-28.4 40.7z"></path></g></svg>
</body>
            
          
!
            
              // Set some defaults
:root {
  --colour: #2EB1B0;
  --size: 50%;
	--rotation: 0deg;
}

svg {
	position: relative;
	z-index: 2;
	width: var(--size);
	height: var(--size);
	transform: rotate(var(--rotation));
	
	path {
		fill: var(--colour);
	}
	
	&, path {
		transition: all 700ms ease;
	}
}

.overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--colour);
	opacity: 0.15;
	transition: background-color 700ms ease;
}

// Codepen config
html,
body {
  margin: 0 auto;
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
	padding: 0 15%;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: #000;
	color: #fff;
}

input {
	cursor: pointer;
}

button {
	position: fixed;
	top: 0;
	right: 25px;
	display: inline-block;
	margin-top: 25px;
	text-transform: uppercase;
	letter-spacing: 2px;
	padding: 7px 7px 7px 9px;
	background-color: transparent;
	color: #fff;
	border: 1px solid #eee;
	font-size: 8px;
	line-height: 1.2;
	cursor: pointer;
	opacity: 0.3;
	transition: all 300ms ease;
	
	&:hover {
		color: #000;
		background-color: #fff;
		opacity: 1;
	}
}

.colour-changer {
	-webkit-appearance: none;
	border: 0;
	width: 100%;
	height: 30px;
	border-radius: 5px;
	
	&::-webkit-color-swatch-wrapper {
		padding: 0;
		border-radius: 5px;
	}
	
	&::-webkit-color-swatch {
		border-radius: 5px;
	}
}

.controls {
	position: absolute;
	top: 5px;
	left: 25px;
	z-index: 2;
	
	label {
		display: block;
		margin-top: 25px;
		padding-bottom: 5px;
		letter-spacing: 2px;
		font-weight: 300;
		font-size: 12px;
		text-transform: uppercase;
	}
	
	input {
		width: 100%;
	}
}
// Codepen config end
            
          
!
            
              (function() {
	
	const page = document.body.style;
	const controls = document.querySelector('.controls');
	const colourChanger = document.querySelector('.colour-changer');
	const sizeChanger = document.querySelector('.size-changer');
	const rotationChanger = document.querySelector('.rotation-changer');
	const initiateDisco = document.querySelector('.disco');
	const discoSpeed = 300;

	// Update properties as they're mofidied via the UI
	function updateProperty(property, value, unit = '') {
		page.setProperty(property, (value + unit))
	}
	
	// Disco time
	function disco2000() {
    let colour = (Math.random() * 500);
		let size = (Math.random() * 100) + 20;
		let rotate = (Math.random() * 90) + -45;
		updateProperty('--colour', 'hsl(' + colour + ', 90%, 50%)');
		updateProperty('--size', size, '%');
		updateProperty('--rotation', rotate, 'deg');
	}
	
	// Watch for changes
	colourChanger.addEventListener('change', () => {
		updateProperty('--colour', colourChanger.value)
	});

	sizeChanger.addEventListener('change', () => {
		updateProperty('--size', sizeChanger.value * 100, '%')
	});

	rotationChanger.addEventListener('change', () => {
		updateProperty('--rotation', rotationChanger.value, 'deg')
	});
	
	initiateDisco.addEventListener('click', () => { 
		setInterval(disco2000, discoSpeed);
    controls.style.display = "none";
	});
	
}());
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console