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

Auto Save

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

              
                <!-- 🛣🚦🚗-->
<main>
	<div class="wrapper">
		<div class="shake-wrapper">
			<div class="star-wrapper">
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
				<span></span>
			</div>
			<div class="plane-wrapper">
				<span></span>
			</div>
			<div class="city-wrapper bg">
				<div class="city-set">
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
				</div>
				<div class="city-set">
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
				</div>
			</div>
			<div class="city-wrapper">
				<div class="city-set">
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
				</div>
				<div class="city-set">
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
					<span></span>
				</div>
			</div>
			<div class="pole-wrapper">
				<div class="pole-wire">
					<div class="pole"></div>
					<div class="wire"></div>
				</div>
				<div class="pole-wire">
					<div class="pole"></div>
					<div class="wire"></div>
				</div>
			</div>
		</div>
	</div>
</main>
              
            
!

CSS

              
                @function rand($min, $max) {
  $rand: random();
  $randomNum: $min + floor($rand * (($max - $min) + 1));
  @return $randomNum;
}

body {
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #111;
}

main {
	.wrapper {
		--shake: 0px;
		width: 60rem;
		height: 36rem;
		position: relative;
		overflow: hidden;
		background-image: linear-gradient(to bottom, #081744, #511486 40%, #ab490e 90%, #f58510);
		border-radius: 4rem 4rem;
		animation: shake 1s infinite linear;
		
		// window frame
		&::before {
			content: '';
			display: block;
			position: absolute;
			width: 100%;
			height: 1rem;
			top: 20%;
			left: 0;
			background-color: #111;
			z-index: 1;
			display: none;
		}
		
		.shake-wrapper {
			--shake: 2px;
			height: 100%;
			width: 100%;
			position: relative;
			animation: inherit;
			
			.plane-wrapper {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				
				&>* {
					display: block;
					position: absolute;
					left: 0%;
					top: 20%;
					width: 6px;
					height: 2px;
					background-color: #111;
					border-radius: 2px;
					animation: fly 90s infinite linear;
					
					&::before, &::after {
						content: '';
						animation: blink 2s infinite linear;
						display: block;
						position: absolute;
						width: 2px;
						height: 2px;
						border-radius: 2px;
					}
					
					&::before {
						background-color: #7edc4e;
					}
					
					&::after {
						left: 3px;
						top: -1px;
						background-color: #9fff1f;
					}
				}
			}
			
			.city-wrapper {
				--scale: 1;
				height: 100%;
				display: flex;
				width: 160rem;
				position: absolute;
				top: 0;
				left: 0;
				animation: move 16s infinite linear;
				
				&.bg {
					animation-duration: 28s;
					top: initial;
					bottom: 5.5%;
					--scale: 0.667;
					
					.city-set {
						&>* {
							background-color: #29160a;
							
							&::before, &::after {
								background-color: #847e65;
							}
						}
					}
				}
				
				.city-set {
					flex: 1;
					height: 100%;
					position: relative;
					overflow: hidden;
					display: flex;
					align-items: flex-end;

					@for $i from 1 through 30 {
						$width: 1 + rand(1, 4);
						$height: 0.1 + 0.16 * random();
						& > *:nth-child(#{$i}) {
							flex: calc(#{$width} * var(--scale));
							height: #{$height * 100%};
							
							&::before {
								grid-column: rand(1, 3);
								grid-row: rand(2, 4);
							}
							
							&::after {
								grid-column: rand(1, 3);
								grid-row: rand(1, 4);
							}
						}
					}
					
					& > * {
						flex: 1;
						height: 20%;
						background-color: #000;
						position: relative;
						transform: inherit;
						padding: calc(1rem * var(--scale)) calc(0.5rem * var(--scale));
						display: grid;
						grid-template-columns: repeat(auto-fill, calc(0.4rem * var(--scale)));
						grid-auto-rows: calc(0.6rem * var(--scale));
						grid-auto-columns: 0px;
						gap: calc(0.4rem * var(--scale));
						transform: scale(1.1);
						
						&::after, &::before {
							content: '';
							display: block;
							background-color: #a0925d;
						}

						&:nth-child(21) {
							height: 33%;
							flex: 2;
							
							&::after {
								display: block;
							}
							
							&::before {
								content: '';
								display: block;
								position: absolute;
								background-color: #f33;
								display: block;
								top: -1rem;
								width: 2px;
								height: 2px;
								border-radius: 2px;
								animation: blink2 3s infinite linear;
								grid-column: 1;
								grid-row: 1;
							}
						}
					}
				}
			}
			
			.pole-wrapper {
				position: absolute;
				left: 0;
				bottom: 0;
				height: 90%;
				animation: move 2s infinite linear;
				display: flex;
				width: 720rem;

				.pole-wire {
					flex: 1;
					height: 100%;
					position: relative;
					overflow: hidden;

					.pole {
						position: absolute;
						left: 0;
						bottom: 0;
						width: 1rem;
						height: 90%;
						background-color: black;

						&::before {
							content: '';
							display: block;
							position: absolute;
							top: 5%;
							height: 2rem;
							width: 100%;
							background-color: inherit;
							transform: scaleX(3);
						}
					}

					.wire {
						position: absolute;
						width: 100%;
						height: 50%;
						border-radius: 100%;
						left: 0;
						top: 0;
						transform: scaleX(1.2) translateY(-45%);
						border: solid 1px black;

						&::before, &::after {
							content: '';
							display: block;
							position: absolute;
							width: 100%;
							height: 100%;
							border: inherit;
							border-radius: inherit;
							transform: scaleY(1.1);
						}

						&::after {
							transform: scaleY(0.95);
						}
					}
				}
			}
			
			.star-wrapper {
				width: 100%;
				height: 30%;
				position: absolute;
				top: 0;
				left: 0;
				
				&>* {
					content: '';
					display: block;
					position: absolute;
					width: 2px;
					height: 2px;
					background-color: white;
					border-radius: 2px;
					
					@for $i from 1 through 10 {
						&:nth-child(#{$i}) {
							--opacity-min: #{0.2 + 0.2 * random()};
							--opacity: #{0.4 + 0.4 * random()};
							top: #{random() * 100%};
							left: #{random() * 100%};
							background-color: #{'hsl'}(#{random() * 360}deg, 70%, 80%);
							animation: twinkle #{3 + 3 * random()}s infinite #{-3 + -10 * random()}s both;
						}
					}
				}
			}
		}
	}
}

@keyframes move {
	from {
		transform: translateX(0);
	}
	
	to {
		transform: translateX(-50%);
	}
}

@keyframes shake {
	0% {
		transform: translateY(0);
	}
	
	3% {
		transform: translateY(var(--shake));
	}
	
	6% {
		transform: translateY(0);
	}
	
	20% {
		transform: translateY(0);
	}
	
	23% {
		transform: translateY(var(--shake));
	}
	
	26% {
		transform: translateY(0);
	}
}

@keyframes twinkle {
	0% {
		opacity: var(--opacity-min);
	}
	
	5% {
		opacity: var(--opacity);
	}
	
	10% {
		opacity: var(--opacity-min);
	}
	
	100% {
		opacity: var(--opacity-min);
	}
}

@keyframes fly {
	0% {
		transform: translate(-20rem, 0rem);
	}
	
	100% {
		transform: translate(100rem, -5rem);
	}
}

@keyframes blink {
	0% {
		opacity: 0;
	}
	
	5% {
		opacity: 0.75;
	}
	
	10% {
		opacity: 0;
	}
	
	20% {
		opacity: 0;
	}
	
	25% {
		opacity: 0.75;
	}
	
	30% {
		opacity: 0;
	}
	
	100% {
		opacity: 0;
	}
}

@keyframes blink2 {
	0% {
		opacity: 0;
	}
	
	25% {
		opacity: 0;
	}
	
	50% {
		opacity: 1;
	}
	
	75% {
		opacity: 0;
	}
	
	100% {
		opacity: 0;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console