Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

              
                - var nl = 4;

pre
	span.token--prop --grad-list
	span.token--punct :
	span.token--val: ul
		- for(var i = 0; i < nl; i++) {
			- var j = i%2, k = ~~(i/2);
			li
				span.token--func radial-gradient
				span.token--punc (
				span.token--args
					span.token--arg
						span.token--kwd circle
						span.token--kwd at
						span.token--num #{j*100}
						if j
							span.token--unit %
						| 
						span.token--num #{k*100}
						if k
							span.token--unit %
					span.token--punc ,
					span.token--arg
						span.token--func var
						span.token--punc (
						span.token--prop --stop-list
						span.token--punc )
				span.token--punc )
		- }
section
	h3 mask layers
	.a3d
		while nl--
			.layer
section
	h3 mask applied to a box
	.box
              
            
!

CSS

              
                @import 'compass/css3';

$nl: 4;
$p: .5em;
$lh: 1.375;
$t: 12s;

$u: floor(100%/$nl/3);

$theme-dark: #222;
$theme-light: invert($theme-dark);

@mixin mask($m) {
	-webkit-mask: $m;
					mask: $m
}

* {
	margin: 0;
	padding: 0;
	list-style: none;
	color: inherit;
	font: inherit
}

body {
	--f: 1;
	height: 100vh;
	display: flex;
	flex-wrap: wrap;
	font: 1em trebuchet ms, verdana, sans-serif;
}

pre {
	overflow: hidden;
	position: relative;
	padding: $p;
	width: 100%;
	font: 1em/ #{$lh} consolas, monaco, monospace;
	color: $theme-light;
	
	&:before {
		position: absolute;
		z-index: -1;
		top: 0; right: 0; bottom: 0; left: 0;
		background: $theme-dark;
		animation: shift $t infinite;
		content: ''
	}
}

ul {
	display: flex;
	flex-direction: column-reverse;
	animation: shift $t infinite
}

@keyframes shift {	
	0% { transform: translatey(calc(var(--f)*#{-$nl*$lh*1em})) }
	
	@for $i from 0 to $nl {
		#{($i + 1/3)*3*$u}, #{($i + 1)*3*$u} {
			transform: translatey(calc(var(--f)*#{($i + 1 - $nl)*$lh*1em}));
		}
	}
}

li {
	margin-left: 2vw;
	max-width: 31em;
	animation: a $t infinite;
	
	&:nth-child(n + 2):after { content: ',' }
	
	&:nth-child(2n) { --s: 1 }
	
	@for $i from 0 to $nl {
		&:nth-child(#{$i + 1}) {
			animation-name: slide#{$i + 1};
		}
		
		@at-root {
			@keyframes slide#{$i + 1} {
				0%, #{($i + 1/3)*3*$u} {
					transform: translate(calc(var(--s, -1)*100%)) scale(.001)
				}
				#{($i + 2/3)*3*$u}, 100% {
					transform: none
				}
			}
		}
	}
}

section {
	flex: 1;
	overflow: hidden;
	position: relative;
	width: 50%; min-height: calc(100vh - #{5*$lh*1em} - #{2*$p});
	perspective: 21em;
	--f: .5;
	animation: shift $t infinite
}

h3 {
	font: 700 1.75em/ 1.5 kalam, comic sans ms, cursive;
	text-align: center;
}

div {
	position: absolute;
	top: 50%; left: 50%;
	width: 16em; height: 16em;
	max-width: 100%;
	transform: translate(-50%, -50%);
}

.token {
	&--prop { color: #dbbae5 }
	
	&--val {
		white-space: normal
	}
	
	&--func {
		color: #b7e3c0;
		
		&:before { content: ' ' }
	}
	
	&--kwd {
		color: #b8d0dd;
		
		&:after { content: ' ' }
	}
	
	&--num { color: #f8f087 }
	
	&--unit { color: #f39dd4 }
}

.a3d { transform-style: preserve-3d }

.layer {
	background: #000;
	animation: l $t infinite;
	
	&:nth-child(2n) { --s: 1 }
	
	@for $i from 0 to $nl {
		$x: ($i%2)*100%;
		$y: floor($i/2)*100%;
		$m: radial-gradient(circle at $x $y, 
						transparent 19%, #000 0);
		
		&:nth-of-type(#{$i + 1}) {
			-webkit-mask: $m;
							mask: $m;
			animation-name: layer#{$i + 1};
			
			&:after { animation-name: fade#{$i + 1} }
			
			@at-root {
				@keyframes layer#{$i + 1} {
					0%, #{($i + 1/3)*3*$u} {
						transform: 
							translate3d(calc(var(--s, -1)*100% - 50%), -150%, 2em) 
							scale(.001);
					}
					#{($i + 2/3)*3*$u}, 100% {
						transform: translate(-50%, -50%) 
					}
				}
				
				@keyframes fade#{$i + 1} {
					0%, #{($i + 2/3)*3*$u} {
						opacity: .99
					}
					#{($i + 1)*3*$u}, 100% {
						opacity: .001
					}
				}
			}
		}
	}
	
	&:after {
		position: absolute;
		top: 0; right: 0; bottom: 0; left: 0;
		background: #b53;
		animation: f $t infinite;
		content: ''
	}
}

@keyframes mask {
	0%, 100% { @include mask(none) }
	
	@for $i from 0 to $nl {
		$m0: ();
		$m1: ();
		$ac0: 0; $ac1: 1;
		$ar0: 1; $ar1: 1;
		
		@for $j from 0 to $nl {
			$x: ($j%2)*100%;
			$y: floor($j%2)*100%;
			
			@if $i == $j {
				@if $i == 0 { $ac0: 1; $ac1: 0 }
				@else { $ac1: 0; $ar0: 0 }
			}
			@elseif $i < $j { $ar0: 0; $ar1: 0 }
			
			$m0: radial-gradient(circle at $x $y, 
							rgba(#000, $ac0) 19%, 
							rgba(#000, $ar0) 0), $m0;
			$m1: radial-gradient(circle at $x $y, 
							rgba(#000, $ac1) 19%, 
							rgba(#000, $ar1) 0), $m1;
		}
		
		#{($i + 2/3)*3*$u} { @include mask($m0) }
		#{($i + 1)*3*$u} { @include mask($m1) }
	}
}

.box {
	display: flex;
	align-items: center;
	justify-content: center;
	background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2017/17_05_a_amur_leopard_0.jpg);
	animation: mask $t infinite;
	
	&:after {
		color: #f90;
		font: 700 2em kalam, cursive;
		text-shadow: 2px 2px #000;
		content: 'Amur Leopard'
	}
}

@media (max-aspect-ratio: 4/5) {
	html { overflow-x: hidden; }
	
	body {
		flex-direction: column;
	}
	
	section {
		width: 100%; min-height: calc(50vh - #{2.5*$lh*1em} - #{$p});
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console