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.

            
              .base
	.hole
	- for (let p = 0; p < 5; ++p) {
		.plate
	- }
            
          
!
            
              // Animation
$dur: 2s;
$timing: ease-out;

// Colors
$blackHue: 0;
$blackSat: 0%;
$black1: hsl($blackHue,$blackSat,15%);
$black2: hsl($blackHue,$blackSat,20%);
$black3: hsl($blackHue,$blackSat,30%);
$black4: hsl($blackHue,$blackSat,50%);
$black4T: hsla($blackHue,$blackSat,50%,0);

$goldHue: 38;
$goldSat: 61%;
$gold1: hsl($goldHue,$goldSat,20%);
$gold2: hsl($goldHue,$goldSat,30%);
$gold3: hsl($goldHue,$goldSat,45%);
$gold4: hsl($goldHue,$goldSat,50%);
$gold5: hsl($goldHue,$goldSat,60%);
$gold5T: hsla($goldHue,$goldSat,60%,0);
$gold6: hsl($goldHue,$goldSat,80%);
$gold6T: hsla($goldHue,$goldSat,80%,0);

* {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
body, .base {
	display: flex;
}
body {
	background: hsl(0,0%,85%);
	font-size: calc(16px + (20 - 16) * (100vw - 320px)/(1024 - 320));
	height: 100vh;
	overflow-x: hidden;
}
.base:before, .base:after, .hole:before, .hole:after, .plate, .plate:before, .plate:after {
	position: absolute;
};
.base, .hole, .plate {
	margin: auto;
	&, &:before, &:after {
		border-radius: 25%;
	}
	&:before, &:after {
		content: "";
		display: block;
	}
}
.base:before, .hole {
	background:
		radial-gradient(100% 100% at bottom left,$black4,$black4T 50%),
		radial-gradient(100% 100% at bottom right,$black4,$black4T 50%),
		linear-gradient($black2,$black3);
}
.base:after, .hole:before {
	background: {
		image: url(https://i.ibb.co/2YmnnBT/plastic-grain-texture.jpg);
		color: $black1;
		blend-mode: luminosity;
	};
}
.base, .plate {
	&:before, &:after {
		width: 100%;
		height: 100%;
	}
	&:before {
		transform: translate(-5%,-5%);
	}
	&:after {
		transform: translate(-6%,-6%);
	}
}
.base {
	background: $black1;
	position: relative;
	width: 15em;
	height: 15em;
	transform: rotateX(30deg) rotateZ(45deg);
	z-index: 0;
	&:after {
		background-size: 100% 100%;
		box-shadow: 0.1em 0.1em 0 $black1 inset;
	}
}
.hole {
	box-shadow:
		0 0 0.1em 0.1em hsla(0,0%,0%,0.5) inset,
		0.1em 0.1em 0.2em 0.2em hsla(0,0%,0%,0.5);
	width: 70%;
	height: 70%;
	transform: translate(-0.9em,-0.9em);
	z-index: 1;
	&:before, &:after {
		top: 2%;
		left: 2%;
		width: 96%;
		height: 96%;
	}
	&:before {
		background-size: 143% 143%;
		box-shadow:
			0.3em 0.3em 0.1em 0.1em hsla(0,0%,0%,0.7) inset,
			-0.1em -0.1em 0.1em 0.1em hsla(0,0%,0%,0.7) inset;
	}
	&:after {
		animation: blurOutIn $dur $timing infinite;
		background: hsl(0,0%,0%);
	}
}
.plate {
	background-image:
		radial-gradient(8% 10% at 18% 102%,$gold6 33%, $gold6T),
		radial-gradient(16% 8% at 106% 10%,$gold6 50%, $gold6T),
		linear-gradient(45deg,$gold2 8%,$gold3 16% 43%,$gold6 46% 50%,$gold3 53% 56%,$gold2 60% 62%,$gold4 65% 87%,$gold2 92%);
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 65%;
	height: 65%;
	transform: translate(-0.9em,-0.9em);
	z-index: 2;
	&:before {
		background:
			radial-gradient(100% 100% at bottom left,$gold6,$gold6T 50%),
			radial-gradient(100% 100% at bottom right,$gold6,$gold6T 50%),
			linear-gradient($gold3,$gold4);
	}
	&:after {
		background: $gold5;
		box-shadow:
			0 0.1em 0 $gold2 inset,
			0 0 0 0.1em $gold6 inset;
	}
	&:nth-child(2) {
		animation: jump1 $dur $timing infinite;
		background-image:
			linear-gradient(45deg,$gold1 8%,$gold2 12% 30%,$gold3 50%,$gold2 70% 88%,$gold1 92%);
	}
	&:nth-child(3), &:nth-child(4) {
		width: 50%;
		height: 50%;
	}
	&:nth-child(3), &:nth-child(5) {
		filter: blur(1px);
		opacity: 0.7;
		&:after {
			background: $gold1;
			box-shadow: 1.5em 1.5em 0.3em $gold2 inset;
		}
	}
	&:nth-child(3) {
		animation: jump2 $dur $timing infinite;
		transform: translate(-1.4em,-1.4em);
		z-index: 3;
	}
	&:nth-child(4) {
		animation: jump3 $dur $timing infinite;
		transform: translate(-1.9em,-1.9em);
		z-index: 4;
	}
	&:nth-child(5), &:nth-child(6) {
		width: 35%;
		height: 35%;
	}
	&:nth-child(5) {
		animation: jump4 $dur $timing infinite;
		transform: translate(-2.4em,-2.4em);
		z-index: 5;
	}
	&:nth-child(6) {
		animation: jump5 $dur $timing infinite;
		transform: translate(-2.8em,-2.8em);
		z-index: 6;
	}
}

/* Animations */
@keyframes blurOutIn {
	from, 40%, to {
		filter: blur(0px);
		opacity: 1;
	}
	10%, 30% {
		filter: blur(3px);
		opacity: 0.5;
	}
}
@keyframes jump1 {
	from, 40%, to {
		transform: translate(-0.9em,-0.9em);
	}
	10%, 30% {
		transform: translate(-1.9em,-1.9em);
	}
}
@keyframes jump2 {
	from, 50%, to {
		filter: blur(1px);
		transform: translate(-1.4em,-1.4em);
	}
	10% {
		filter: blur(1px);
		transform: translate(-2.4em,-2.4em);
	}
	20%, 30% {
		filter: blur(4px);
		transform: translate(-1.9em,-1.9em);
	}
	40% {
		filter: blur(7px);
		transform: translate(-0.4em,-0.4em);
	}
}
@keyframes jump3 {
	from, 50%, to {
		transform: translate(-1.9em,-1.9em);
	}
	10% {
		transform: translate(-2.9em,-2.9em);
	}
	20%, 40% {
		transform: translate(-3.9em,-3.9em);
	}
}
@keyframes jump4 {
	from, 60%, to {
		filter: blur(1px);
		transform: translate(-2.4em,-2.4em);
	}
	10% {
		transform: translate(-3.4em,-3.4em);
	}
	20% {
		filter: blur(1px);
		transform: translate(-4.4em,-4.4em);
	}
	30%, 40% {
		filter: blur(4px);
		transform: translate(-3.9em,-3.9em);
	}
	50% {
		filter: blur(7px);
		transform: translate(-1.4em,-1.4em);
	}
}
@keyframes jump5 {
	from, 60%, to {
		transform: translate(-2.8em,-2.8em);
	}
	10% {
		transform: translate(-3.8em,-3.8em);
	}
	20% {
		transform: translate(-4.8em,-4.8em);
	}
	30%, 50% {
		transform: translate(-5.8em,-5.8em);
	}
}
            
          
!
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