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

              
                <div class="container">
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
	<svg viewbox="0 0 100 100" class="circle"><circle cx="50" cy="50" r="40" /></svg>
</div>

<div class="playground">
	You can edit the CSS variables yourself
	</br>
	or you can select a preset:
	</br>
	<button id="default">Default</button>
	<button id="void">Void</button>
	<button id="random">Random</button>
</div>
              
            
!

CSS

              
                body { background: black; height: 100vh; overflow: hidden; }

.container {
	// 🎈 Edit the variables bellow and have fun!
	// TIP: Do it directly on the browser for even more fun
	--size: 35vh;
	--speed: 3s;
	--delay: 150ms;
	--ease: cubic-bezier(.48,0,.48,1);
	--scaleStart: 0.8;
	--scaleEnd: 1;
	--rotate: 30deg;
	--rotatePivot: 2deg;
	--fill: #61fbf424;
	--distance: 20rem;
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	height: var(--size);
	width: calc(var(--size) + var(--distance));
}

.circle {
	position: absolute;
	top: 0;
	left: 0;
	width: var(--size);
	stroke: white;
	stroke-width: 1;
	fill: var(--fill);
	animation: circleMove var(--speed) var(--ease) infinite alternate-reverse;

	@for $i from 1 through 10 {
		&:nth-child(#{$i}) {
			// [1] - Start in a middle so it's pretty on first render when the animation didn't start yet.
			animation-delay: calc((var(--speed) * -1) - #{-$i} * var(--delay) - 2100ms); // 1
			// animation-play-state: paused; // TIL: use to see exactly the 1st frame
			$dash: 0;
			$gap: 0;
			@if $i > 1 {
				$dash: 10 - $i;
				$gap: $i - 1;	
			}
			stroke-dasharray: $dash, $gap;
			opacity: 1-(1*$i*0.07);
			--rotatePivot: #{$i*3}deg;

			transform:
				translateX(0)
				scale(var(--scaleStart))
				rotate( calc(0deg + var(--rotatePivot)) ); // 1
		}
	}
}

@keyframes circleMove {
	from {
		transform:
			translateX(0)
			scale(var(--scaleStart))
			rotate( calc(0deg + var(--rotatePivot)) );
		filter: drop-shadow(3px 0px 0px rgba(#900, 0.5));
	}
	to {
		transform:
			translateX(var(--distance))
			scale(var(--scaleEnd))
			rotate( calc(var(--rotate) + var(--rotatePivot)) );
		filter: drop-shadow(1px 0px 0px rgba(#900, 0.8));
	}
}

.playground {
	position: absolute;
	bottom: 0; left: 0;
	color: #aaa;
	padding: 1rem;
	width: 100vw;
	font-size: 0.8rem;
	
	button {
		border: 1px solid #aaa;
		background: transparent;
		margin-top: 0.5rem;
		color: #aaa;
		padding: 0.2rem;
		width: 5rem;
		
		&:active,
		&:focus {
			background: #aaa;
			color: black;
		}
	}
}
              
            
!

JS

              
                // No JS needed for the actual animation.
// This is used for "Random" button click.

const container = document.getElementsByClassName('container')[0];

document.getElementById('default').addEventListener('click', () => {
	container.style.setProperty('--size', '')
	container.style.setProperty('--speed', '')
	container.style.setProperty('--delay', '')
	container.style.setProperty('--scaleStart', '')
	container.style.setProperty('--scaleEnd', '')
	container.style.setProperty('--rotate', '')
	container.style.setProperty('--rotatePivot', '')
	container.style.setProperty('--rotatePivot', '')
	container.style.setProperty('--fill', '')
	container.style.setProperty('--distance', '');
});

document.getElementById('void').addEventListener('click', () => {
	container.style.setProperty('--size', '')
	container.style.setProperty('--speed', '4s')
	container.style.setProperty('--delay', '150ms')
	container.style.setProperty('--scaleStart', '0.8')
	container.style.setProperty('--scaleEnd', '-1')
	container.style.setProperty('--rotate', '45deg')
	container.style.setProperty('--rotatePivot', '')
	container.style.setProperty('--fill', '')
	container.style.setProperty('--distance', '');
});

function random(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min)) + min;
}

function getAcolor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return `${color}AD`; // AD = 80% opacity
}

document.getElementById('random').addEventListener('click', () => {
	container.style.setProperty('--size', `${random(20, 50)}vh`);
	container.style.setProperty('--speed', `${random(3, 6)}s`);
	container.style.setProperty('--delay', `${random(100, 600)}ms`);
	container.style.setProperty('--scaleStart', `${random(-10, 10)/10}`);
	container.style.setProperty('--scaleEnd', `${random(-10, 10)/10}`);
	container.style.setProperty('--rotate', `${random(0, 90)}deg`);
	container.style.setProperty('--rotatePivot', `${random(0, 90)}deg`);
	container.style.setProperty('--distance', `${random(5, 60)}vh`);
	container.style.setProperty('--fill', getAcolor());
});
              
            
!
999px

Console