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.

            
              - var segments = 30;
.cat
	- while (segments--) {
		.cat__segment
	- }
            
          
!
            
              $angleSpan: 40deg;
$dur: 2s;
$delayInc: $dur / 100;
$segments: 30;
$timing: cubic-bezier(0.6,0,0.4,1);
$playState: running;

// colors
$w1: hsl(0,0%,100%);
$w1T: hsla(0,0%,100%,0);
$w2: hsl(0,0%,90%);
$w2T: hsla(0,0%,90%,0);
$w3: hsl(0,0%,80%);
$w3T: hsla(0,0%,80%,0);
$bk: hsl(0,0%,10%);
$bkT: hsla(0,0%,10%,0);
$pk: hsl(0,60%,75%);
$pkT: hsla(0,60%,75%,0);

* {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
body {
	background: hsl(210,38%,28%);
	display: flex;
	font-size: 16px;
	height: 100vh;
	line-height: 1.5;
}
.cat {
	margin: auto;
	position: relative;
	width: 16em;
	height: 16em;
	&__segment {
		position: absolute;
		top: 50%;
		left: 50%;
		width: 3em;
		height: 2em;
		transform: translate(-50%,-50%);
		&:before {
			animation: loop $dur $timing infinite $playState;
			background: linear-gradient(90deg,$w1 20%,$w2 20% 80%,$w1 80%);
			border-radius: 0.25em;
			content: "";
			display: block;
			will-change: transform;
			width: 100%;
			height: 100%;
		}
		&:first-of-type {
			width: 4em;
			height: 4em;
			z-index: 1;
			&:before {
				background:
					// eyes
					radial-gradient(0.25em 0.25em at 1.25em 1.6em,$w1 48%,$w1T 50%),
					radial-gradient(0.75em 0.75em at 1.25em 1.75em,$bk 48%,$bkT 50%),
					radial-gradient(0.25em 0.25em at 2.75em 1.6em,$w1 48%,$w1T 50%),
					radial-gradient(0.75em 0.75em at 2.75em 1.75em,$bk 48%,$bkT 50%),
					// mouth
					radial-gradient(0.9em 0.8em at 1.5em 2.65em,$w1 48%,$w1T 50%),
					radial-gradient(0.9em 0.8em at 2.5em 2.65em,$w1 48%,$w1T 50%),
					radial-gradient(1em 0.8em at 1.6em 2.75em,$w3 48%,$w3T 50%),
					radial-gradient(1em 0.8em at 2.4em 2.75em,$w3 48%,$w3T 50%),
					// nose
					radial-gradient(0.75em 0.75em at 50% 2.5em,$pk 48%,$pkT 50%),
					// head
					radial-gradient(4em 3em at 50% 2em,$w1 48%,$w1T 50%),
					radial-gradient(4em 3em at 50% 2.2em,$w3 48%,$w3T 50%),
					// ears
					radial-gradient(1em 3em at 0.75em 1.5em,$pk 39%,$w1 40% 49%,$w1T 50%),
					radial-gradient(1em 3em at 3.25em 1.5em,$pk 39%,$w1 40% 49%,$w1T 50%),
					// paws
					radial-gradient(1em 2em at 0.5em 2.8em,$w1 48%,$w1T 50%),
					radial-gradient(1em 2em at 0.5em 3em,$w3 48%,$w3T 50%),
					radial-gradient(1em 2em at 3.5em 2.8em,$w1 48%,$w1T 50%),
					radial-gradient(1em 2em at 3.5em 3em,$w3 48%,$w3T 50%);
				background-repeat: no-repeat;
			}
		}
		&:last-of-type {
			width: 3em;
			height: 4em;
			&:before {
				background:
					linear-gradient(90deg,$w1 20%,$w2 20% 80%,$w1 80%) 0 1.5em / 3em 0.5em,
					radial-gradient(3em 2em at top center,$w2 30%,$w1 31% 48%,$w1T 50%) 0 2em /  3em 2em,
					radial-gradient(1em 4em at 0.5em 0,$w1 48%,$w1T 50%) 0 2em / 3em 2em,
					radial-gradient(1em 4em at 2.5em 0,$w1 48%,$w1T 50%) 0 2em / 3em 2em;
				background-repeat: no-repeat;
			}
		}
		$negAngleHalf: -$angleSpan/2;
		$angleInc: $angleSpan/$segments;
		@for $s from 1 through $segments {
			$rotateBy: $angleInc * ($s - 1);
			&:nth-of-type(#{$s}) {
				transform: translate(-50%,-50%) rotate($negAngleHalf + $rotateBy);
			}
			&:nth-of-type(#{$s}):before {
				animation-delay: $delayInc * ($s - 1);
				transform: translateX(6em);
			}
		}
	}
}

// animation
@keyframes loop {
	from {
		transform: rotate(0) translateX(6em);
	}
	to {
		transform: rotate(-1turn) translateX(6em);
	}
}
            
          
!
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