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

              
                <div class="container container-1">
	<svg class="symbol" width="100%" height="100%" viewBox="0 0 1114 498" version="1.1" xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"><path d="M556.639,248.609c53.406,53.406 101.683,111.534 164.527,155.683c32.351,22.727 69.175,43.083 109.585,49.008c28.958,4.245 59.488,0.613 87.317,-7.576c26.905,-7.918 52.087,-20.892 73.811,-37.871c21.56,-16.851 39.677,-37.626 53.018,-60.895c10.19,-17.771 17.616,-36.957 21.888,-56.774c4.437,-20.585 5.532,-41.765 3.304,-62.666c-8.654,-81.211 -69.752,-151.815 -152.021,-176.024c-21.015,-6.185 -42.784,-9.169 -64.773,-9.286c-20.432,-0.109 -41.041,2.144 -60.735,7.389c-60.474,16.105 -104.752,61.37 -145.625,103.912c-25.822,26.876 -51.28,54.064 -76.924,81.093c-50.066,52.771 -98.707,107.45 -153.977,155.565c-26.704,23.247 -58.379,43.63 -92.848,54.868c-68.352,22.285 -146.537,6.002 -201.788,-37.182c-21.56,-16.851 -39.676,-37.626 -53.018,-60.895c-10.19,-17.771 -17.616,-36.957 -21.887,-56.774c-20.542,-95.293 34.073,-193.859 128.699,-231.746c26.53,-10.622 55.918,-16.645 84.79,-16.23c66.027,0.948 126.189,41.423 172.681,82.451c12.721,11.225 25.299,22.604 37.509,34.327c11.528,11.07 22.61,22.551 33.684,34.029c17.75,18.398 34.689,37.5 52.783,55.594Z" style="fill:none;stroke-width:84.38px;"/></svg>
	<div class="crt"></div>
	<div class="message">Change width</div>
</div>


              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

$loop-duration: 2;

$ultramarine: #4206f1;
$magenta: #fe18d3;
$yellow: #feff38;
$red: #ff2941;
$purple: #871a85;
$violet: #270245;
$green: #a09f43;

$breakpoint-sm: 800px;
$breakpoint-md: 1200px;
$breakpoint-lg: 1600px;
$breakpoint-xl: 2000px;

@function generateShadow($color) {
	@return drop-shadow(0 0 12px #{$color}77) drop-shadow(0 0 4px #{$color}77)
		drop-shadow(0 0 36px #{$color}77) drop-shadow(0 0 64px #{$color}dd);
}

*,
*::before,
*::after {
	position: relative;
	box-sizing: border-box;
}

body {
	font-family: "Press Start 2P", monospace;
	margin: 0;
	display: grid;
	place-content: center;
	min-height: 100vh;
	width: 100%;
	grid-template-columns: 100%;
}

.message {
	position: absolute;
	bottom: 2rem;
	width: 100%;
	text-align: center;
	left: 0;
	z-index: 0;
	color: $purple;
	font-size: 1rem;
	text-shadow: 0 0 1rem $purple;
	line-height: 1.2;
}

.container {
	width: 100%;
	background: $violet;
	display: grid;
	place-content: center;
	margin: auto;
	overflow: hidden;
	min-height: 100vh;
	grid-template-columns: 100%;
}

.crt {
	width: 100%;
	height: 100vh;
	position: absolute;
	background: repeating-linear-gradient(
		to bottom,
		transparent,
		transparent 0.125rem,
		$violet 0.125rem,
		$violet 0.25rem
	);
	opacity: 0.8;
	z-index: 2;

	&::before {
		display: none;
	}

	&::after {
		content: "";
		width: 100%;
		height: 24px;
		background: rgba(255, 255, 255, 0.02);
		position: absolute;
		top: 100%;
		left: 0;
		animation: roll 5s linear infinite;
	}
}

.symbol {
	stroke-dasharray: 3000;
	margin: auto;
	width: 100%;
	max-width: 320px;
	animation: loop #{$loop-duration}s infinite cubic-bezier(0.65, 0, 0.35, 1),
		pulse #{$loop-duration * 5}s infinite steps(1, end);

	@media (max-width: 1911px) {
		left: 0 !important;
		top: 0 !important;
	}
}


/*********************************************************************************************
	Small screens
**********************************************************************************************/

@media (min-width: $breakpoint-sm) {
	body::after {
		content: "";
		width: 240px;
		height: 50vw;
		position: absolute;
		bottom: 0;
		left: calc(50% - 120px);
		background: linear-gradient(to right, #eee2, #eeef, #4447);
		box-shadow: inset 1rem 2rem 3rem 1rem #3334, -8px 8px 8px 8px #fff8,
			inset 0 4px 4px 4px #eeef, 0 0 0 2rem #eeef, 2rem 2rem 3rem 1rem #4446,
			inset -1px 3px 1px 3px #fff9;
		display: block;
		z-index: -1;
	}

	.container {
		min-height: 600px;
		width: 800px;
		border-radius: 35%/30%;
		box-shadow: -16px -16px 8px -16px #0005, inset 16px 16px 32px 16px #0008,
			inset 32px 32px 32px 8px #fff5, inset -16px -16px 32px 16px #0008,
			-16px -16px 23px 0px #fffc, 16px 16px 23px 0px #fffa,
			/* Border */ 8px 8px 8px 16px #0003, -8px -8px 8px 16px #fff3,
			0 0 0 32px #bbbf, 42px 42px 42px 32px #0003, -16px 16px 32px 16px #0007;
	}
	
	.message {
		color: $yellow;
		text-shadow: 0 0 1em $yellow;
		
		&::after {
			width: 1ch;
			height: 1em;
			content: "";
			position: absolute;
			animation: flicker 1s infinite steps(1, end);
		}
	}
}

/*********************************************************************************************
	Medium screens
**********************************************************************************************/

@media (min-width: $breakpoint-md) {	
	body {
		transform: translateY(-15vmin);

		&::after {
			content: '';
			width: 46vmin;
			height: 64vmin;
			background: #eee;
			position: absolute;
			border-radius: 24px;
			border-bottom-right-radius: 10vmin;
			left: calc(50% - 23vmin);
			top: calc(50% - 19.5vmin);
			box-shadow: 
				inset -8px -8px 4px 0 #eeec,
				inset -20px -10px 16px 0 #3331,
				inset 8px 8px 4px 0 #eeef,
				inset 12px 8px 8px 0 #ffff,
			;
		}
		
		&::before {
			content: '+';
			font-family: sans-serif;
			font-weight: bold;
			width: 4vmin;
			height: 4vmin;
			font-size: 16vmin;
			position: absolute;
			border-radius: 4vmin;
			left: calc(50% - 20vmin);
			top: calc(50% + 20vmin);
			line-height: 0.9;
			text-shadow: 2px 2px 2px #3338, -2px -2px 2px #fff8;
			box-shadow: 				
				34.75vmin 4vmin 0.75vmin -0.5vmin #fff2,
				35vmin 4.25vmin 0 0 #9b2057,
				35.2vmin 4.45vmin .1vmin 0 darken(#9b2057, 5%),
				
				28.75vmin 6.25vmin 0.75vmin -0.5vmin #fff2,
				29vmin 6.5vmin 0 0 #9b2057,
				29.2vmin 6.7vmin .1vmin 0 darken(#9b2057, 5%),
				;
		}
	}
		
	.container {
		border-radius: 2px;
		min-height: 27vmin;
		width: 30vmin;
		margin: 48px auto;
		background: $green;
		box-shadow: 
			inset 4px 4px 4px #6666,
			-3vmin -2vmin 3vmin 0 #fff2,
			-2px -2px 1px #0003,
		 	-4vmin -2vmin 0 1vmin #aaa,
			-4vmin 2vmin 0 1vmin #aaa,
			4vmin -2vmin 0 1vmin #aaa,
			2vmin 0 0 3vmin #aaa,
			-2vmin 0 0 3vmin #aaa,
		;
	}

	.crt {
		$gradient: transparent, transparent 2px, $green 2px, $green 3px;
		
		opacity: 1;
		background: repeating-linear-gradient(to bottom, $gradient);

		&::before {
			content: '';
			width: 100%;
			height: 100%;
			display: block;
			background: repeating-linear-gradient(to right, $gradient);
		}

		&::after {
			display: none;
		}
	}

	.symbol {
		max-width: 160px;
		stroke-dashoffset: 3000;
		animation: loop #{$loop-duration}s infinite cubic-bezier(0.65, 0, 0.35, 1) forwards, hide 4s steps(1);
		stroke: #333;
	}

	.message {
		color: #333;
		text-shadow: none;
		font-size: 1rem;
		animation: float_down 3s linear forwards;
		bottom: 4px;
		left: 0px;
		font-size: 20px;
		
		&::after {
			display: none;
		}
	}
}


/*********************************************************************************************
	Large screens
**********************************************************************************************/

@media (min-width: $breakpoint-lg) {
	body {
		animation: none;
		transform: none;
		overflow: hidden;
		
		&::after {
			content: "";
			box-shadow: none;
			border-radius: 0;
			width: 80vw;
			height: 100vh;
			position: absolute;
			left: 10vw;
			top: -0vw;
			transform: rotate(-24deg);
			transform-origin: center;
			background: $ultramarine;
			mix-blend-mode: overlay;
			z-index: 1;
			animation: hue_rotate 5.7s linear infinite, rotate 17s linear infinite;
		}
		
		&::before {
			display: none;
		}
	}

	.container {
		min-height: 100vh;
		width: 100%;
		min-height: 100vh;
		border-radius: 0;
		background: #101;
		box-shadow: none;
		margin: 0 auto;
		animation: none;
	}

	.crt {
		background: repeating-linear-gradient(
			to bottom,
			transparent,
			transparent 0.1vw,
			#101 0.1vw,
			#101 0.4vw
		);
		opacity: 1;
		transform-origin: center;
		animation: scale 45s linear infinite;

		&::before {
			background: repeating-linear-gradient(
				to right,
				transparent,
				transparent 0.1vw,
				#101 0.1vw,
				#101 0.4vw
			);
		}

		&::after {
			display: none;
		}
	}

	.symbol {
		max-width: 20vw;
		stroke-dashoffset: unset;
		animation: loop #{$loop-duration}s infinite cubic-bezier(0.65, 0, 0.35, 1),
			pulse #{$loop-duration * 5}s infinite steps(1, end);
	}

	.message {
		color: $purple;
		text-shadow: 0 0 1rem $purple;
		font-size: 2rem;
		bottom: 2rem;
		animation: none;
	}
}


/*********************************************************************************************
	Extra large screens
**********************************************************************************************/

@media (min-width: $breakpoint-xl) {
	body::after { display: none; }
	
	.container {
		background: $violet;
	}

	.crt {
		background: repeating-linear-gradient(
			to bottom,
			transparent,
			transparent 1px,
			$violet 1px,
			$violet 3px
		);
		animation: none;

		&::before {
			display: none;
		}

		&::after {
			display: block;
		}
	}

	.symbol {
		position: absolute;
		height: auto;
		left: calc(50% - 146px);
		top: calc(50% - 88px);
		animation: pulse #{$loop-duration * 5}s infinite steps(1, end);
		transform: translate(var(--translateX), var(--translateY));
		transition: transform 0.05s linear;
	}

	.message {
		font-size: 24px;
		color: $ultramarine;
		text-shadow: 0 0 12px $ultramarine;
	}
}

/*********************************************************************************************
	✨ Animations ✨ 
**********************************************************************************************/

@keyframes loop {
	0% {
		stroke-dashoffset: 3150;
	}
	50% {
		stroke-dashoffset: 0;
	}
	100% {
		stroke-dashoffset: -2850;
	}
}

@keyframes pulse {
	0% {
		stroke: $magenta;
		filter: generateShadow($magenta);
	}
	20% {
		stroke: $red;
		filter: generateShadow($red);
	}
	40% {
		stroke: $purple;
		filter: generateShadow($purple);
	}
	60% {
		stroke: $yellow;
		filter: generateShadow($yellow);
	}
	80% {
		stroke: $ultramarine;
		filter: generateShadow($ultramarine);
	}
}

@keyframes roll {
	from {
		transform: translateY(0);
	}
	to {
		transform: translateY(-105vh);
	}
}

@keyframes hue_rotate {
	from {
		filter: hue-rotate(0deg);
	}
	to {
		filter: hue-rotate(360deg);
	}
}

@keyframes rotate {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

@keyframes scale {
	from {
		transform: scale(1);
	}
	to {
		transform: scale(3);
	}
}

@keyframes flicker {
	0% {
		background: currentColor;
	}
	50% {
		background: transparent;
	}
	0% {
		background: currentcolor;
	}
}

@keyframes float_down {
	from {
		transform: translateY(-26vmin);
	}
	to {
		transform: translateY(0);
	}
}

@keyframes hide {
	from { opacity: 0; }
	to { opacity: 1; }
}
              
            
!

JS

              
                // Used only at largest breakpoint
let travelingRight = true
let travelingDown = true
const symbol = document.querySelector('.symbol')
const cssVars = document.documentElement.style
cssVars.setProperty('--translateX', '0px')
cssVars.setProperty('--translateY', '0px')

const getRootX = () => parseFloat(cssVars.getPropertyValue('--translateX'))
const getRootY = () => parseFloat(cssVars.getPropertyValue('--translateY'))

setInterval(() => {
	if (window.innerWidth >= 1920) {
		const symbolCoords = symbol.getBoundingClientRect()

		const isAtTop = symbolCoords.top <= 1
		const isAtRight = (symbolCoords.right) >= (window.innerWidth - 1)
		const isAtBottom = (symbolCoords.bottom) >= (window.innerHeight - 1)
		const isAtLeft = symbolCoords.left <= 1
	
		if (isAtTop) {
			travelingDown = true
		} else if (isAtBottom) {
			travelingDown = false
		}
		
		if (isAtRight) {
			travelingRight = false
		} else if (isAtLeft) {
			travelingRight = true
		}

		const newX = travelingRight ? getRootX() + 5 : getRootX() - 5
		const newY = travelingDown ? getRootY() + 5 : getRootY() - 5
		
		cssVars.setProperty('--translateX', newX + 'px')
		cssVars.setProperty('--translateY', newY + 'px')
	}
}, 40)


// Resize observer, just to keep animations synced during resizes.
const onResize = () => {
	symbol.style.animationPlayState = 'paused'
	
	setTimeout(() => { 
		symbol.style.animationPlayState = 'running'
	}, 200)
}

const observer = new ResizeObserver(onResize)
observer.observe(document.querySelector('body'))
              
            
!
999px

Console