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

              
                <svg style="position: fixed;" xmlns='http://www.w3.org/2000/svg'>
	<filter id="led-screen">
		<feFlood id="filterPxl" x="7" y="7" width="2" height="2" result="flood"></feFlood>
		<feComposite id="filterCs" in="flood" in2="flood" operator="over" x="0" y="0" width="16" height="16" result="composite"></feComposite>
		<feTile x="0" y="0" width="10000" height="10000" in="composite" result="tile"></feTile>
		<feComposite in="SourceGraphic" in2="tile" operator="in"></feComposite>
		<feMorphology id="filterMorph" operator="dilate" radius="7" in="composite2" result="morphology"></feMorphology>
		<feImage id="filterCsImg" xlink:href="data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cellipse ry='25' rx='25' id='svg_1' cy='50' cx='50' /%3E%3C/svg%3E" x="0" y="0" width="16" height="16" preserveAspectRatio="xMidYMid meet" crossorigin="anonymous" result="image"></feImage>
		<feTile x="0" y="0" width="10000" height="10000" in="image" result="tile1"></feTile>
		<feComposite in="morphology" in2="tile1" operator="in" result="composite3"></feComposite>

		<feGaussianBlur stdDeviation="25" in="composite3" result="blur3" />

		<feBlend mode="screen" in="blur3" in2="composite3" result="blend" />

		<feComposite in="blend" in2="composite3" operator="over" result="composite5"></feComposite>

		<!-- 	Canva	 -->
		<feFlood flood-color="#000" id="canva" result="flood1"></feFlood>
		<feMerge result="merge">
			<feMergeNode in="flood1"></feMergeNode>
			<feMergeNode in="composite6"></feMergeNode>
			<feMergeNode in="composite5"></feMergeNode>
		</feMerge>

	</filter>
	<filter id="8bit-color" color-interpolation-filters="sRGB">
		<feComponentTransfer>
			<feFuncR type="discrete" tableValues="0 0.125 0.251 0.376 0.502 0.627 0.753 0.878" />
			<feFuncG type="discrete" tableValues="0 0.125 0.251 0.376 0.502 0.627 0.753 0.878" />
			<feFuncB type="discrete" tableValues="0 0.251 0.502 0.753" />
			<feFuncA type="identity" />
		</feComponentTransfer>
	</filter>
</svg>
<div id="movableDiv" class="filter"></div>

<div class="shadow">

</div>

<div class="marquee">
	<div class="track">
		<h1>LED Screen</h1>
	</div>
</div>

<p>Not in Firefox</p>

<div class="tool-bar">

	<details>
		<summary>🔧</summary>

		<label for="sizeInput">Dots Size</label>
		<input type="range" min="4" max="40" value="16" id="sizeInput">

		<label for="canvaSizeInput">Screen Size</label>
		<input type="range" min="80" max="512" value="320" id="canvaSizeInput">

	</details>
</div>

<div class="more-pens">
	<a target="_blank" href="https://codepen.io/rodzyk/pen/vYbPvaZ" title="SVG Filter — LED Screen">
		<img src="https://codepen.io/rodzyk/pen/vYbPvaZ/image/small.png" alt="SVG Filter — Pixelate">
	</a>
	<a target="_blank" href="https://codepen.io/rodzyk/pen/ZEPGyYx" title="SVG Filter — Pixelate">
		<img src="https://codepen.io/rodzyk/pen/ZEPGyYx/image/small.png" alt="SVG Filter — Cross-stitch">
	</a>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@900&display=swap");

.filter {
	position: fixed;
	width: min(90vw, 90vh);
	aspect-ratio: 10/7;
	user-select: none !important;
	pointer-events: none;
	touch-action: none;
	// border-radius: 50%;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	backdrop-filter: url(#led-screen);
	box-shadow: var(--shadow-elevation-high);

	// border: 4px solid;

	z-index: 1;

	color: #aaa;
	&::before,
	&::after {
		// content: "";
		position: absolute;
		border: 4px solid;
		width: 20%;
		height: 1rem;
		top: calc(-3rem + 5px);
		left: 50%;
		transform: translate(-50%);
	}

	&::before {
		width: 10%;
		top: calc(-2rem + 9px);
		border-bottom: 0;
	}

	&::after {
		background-color: currentColor;
		border-radius: 4px;
	}
}

h1 {
	margin: 0;
	--fsize: clamp(2rem, 16vw, 16rem);
	font-size: var(--fsize);
	text-transform: uppercase;
	text-align: center;
	color: white;
	// animation: waviy 4s infinite;
	font-family: "Orbitron", sans-serif;
	margin: 0;
}

.marquee {
	--fsize: clamp(2rem, 16vw, 16rem);
	font-size: var(--fsize);
	position: relative;
	width: 100vw;
	max-width: 100%;
	height: 1lh;
	overflow-x: hidden;
}

.track {
	position: absolute;
	white-space: nowrap;
	// will-change: transform;
	animation: marquee 8s linear infinite;
}

@keyframes marquee {
	from {
		transform: translateX(100%);
	}
	to {
		transform: translateX(-100%);
	}
}

html {
	--surface: hsl(200 10% 10%);
	--text: hsl(200 5% 80%);
	--hero-h: calc(100vh - 40px);

	background-color: var(--surface);
	color: var(--text);
	block-size: 100%;
}

body {
	--background-color: #316760;
	touch-action: none;
	font-family: "Orbitron", sans-serif;
	background: url(https://i.imgur.com/Xn1UNWn.jpg) no-repeat center/cover;
	min-block-size: 100%;
	min-inline-size: 100%;
	margin: 0;
	box-sizing: border-box;
	font-family: system-ui, sans-serif;
	overflow-y: auto;
	display: grid;
	place-content: center;
}

.tool-bar {
	position: fixed;
	display: grid;
	max-width: 320px;
	width: 100%;
	padding: 1rem;
	right: 1ch;
	background-color: rgba(#161a20, 1);
	border-radius: 0 0 1ch 1ch;
	z-index: 3;
	box-shadow: var(--shadow-elevation-high);

	input {
		width: 100%;
	}

	&:has(details:not(details[open])) {
		width: auto;
	}
}

:root {
	--shadow-color: 0deg 0% 9%;
	--shadow-elevation-low: 0.3px 0.5px 0.7px hsl(var(--shadow-color) / 0.34),
		0.4px 0.8px 1px -1.2px hsl(var(--shadow-color) / 0.34),
		1px 2px 2.5px -2.5px hsl(var(--shadow-color) / 0.34);
	--shadow-elevation-medium: 0.3px 0.5px 0.7px hsl(var(--shadow-color) / 0.36),
		0.8px 1.6px 2px -0.8px hsl(var(--shadow-color) / 0.36),
		2.1px 4.1px 5.2px -1.7px hsl(var(--shadow-color) / 0.36),
		5px 10px 12.6px -2.5px hsl(var(--shadow-color) / 0.36);
	--shadow-elevation-high: 0.3px 0.5px 0.7px hsl(var(--shadow-color) / 0.34),
		1.5px 2.9px 3.7px -0.4px hsl(var(--shadow-color) / 0.34),
		2.7px 5.4px 6.8px -0.7px hsl(var(--shadow-color) / 0.34),
		4.5px 8.9px 11.2px -1.1px hsl(var(--shadow-color) / 0.34),
		7.1px 14.3px 18px -1.4px hsl(var(--shadow-color) / 0.34),
		11.2px 22.3px 28.1px -1.8px hsl(var(--shadow-color) / 0.34),
		17px 33.9px 42.7px -2.1px hsl(var(--shadow-color) / 0.34),
		25px 50px 62.9px -2.5px hsl(var(--shadow-color) / 0.34);
}

@keyframes waviy {
	0%,
	20%,
	40% {
		transform: translateY(0);
	}
	10% {
		transform: translateY(-1ch);
	}
}

.more-pens {
	position: absolute;
	bottom: 0;
	display: flex;
	gap: 1ch;
	padding: 1ch;
	max-height: 128px;
	filter: drop-shadow(0 0 1rem #0008);
	z-index: 2;

	a {
		display: flex;
		justify-content: center;
		img {
			display: block;
			max-width: 100%;
			height: auto;
			transition: all ease-in-out 0.3s;
		}
		&:hover {
			img {
				transform: scale(1.1);
			}
		}
	}
}

              
            
!

JS

              
                const SIZE = 16;
let moveStep = SIZE;
const MAGNETIC_DEGS = [];

sizeInput.oninput = (e) => sizeInputHandler();
canvaSizeInput.oninput = (e) => canvaSizeInputHandler();
// canvaColorInput.oninput = (e) => canvaColorInputHandler();

function canvaColorInputHandler() {
	const v = canvaColorInput.value;

	canva.setAttribute("flood-color", v);
	resetFilter();
}

function canvaSizeInputHandler() {
	const v = magnetic(MAGNETIC_DEGS, parseInt(canvaSizeInput.value));

	movableDiv.style.setProperty("width", v + "px");
}
async function sizeInputHandler() {
	const x = magnetic(MAGNETIC_DEGS, parseInt(sizeInput.value));
	sizeInput.value = x;

	changeSize(x);

	// window.dispatchEvent(new Event('resize'));
	resetFilter();
}

function sleep(ms) {
	return new Promise((resolve) => setTimeout(resolve, ms));
}

async function resetFilter() {
	movableDiv.style.setProperty("backdrop-filter", "none");
	await sleep(10);
	movableDiv.style.setProperty("backdrop-filter", "url(#led-screen)");
}

const div = document.getElementById("movableDiv");

let startX = 0;
let startY = 0;

function moveDiv(event) {
	var x = event.clientX;
	var y = event.clientY;
	// div.style.left = x + "px";
	// div.style.top = y + "px";

	if (Math.abs(startX - x) > moveStep) {
		div.style.left = x + "px";
		startX = x;
	}
	if (Math.abs(startY - y) > moveStep) {
		div.style.top = y + "px";
		startY = y;
	}
}

document.addEventListener("pointermove", moveDiv);

//
//
//

const filterPxl = document.querySelector("#filterPxl");
const filterCs = document.querySelector("#filterCs");
const filterCsImg = document.querySelector("#filterCsImg");
const filterCsImg2 = document.querySelector("#filterCsImg2");
const filterMorph = document.querySelector("#filterMorph");

function changeSize(size) {
	const pxl = size % 2 == 0 ? 2 : 1;
	const shift = (size - pxl) / 2;
	console.clear();
	console.log(size, pxl, shift);

	filterMorph.setAttribute("radius", (shift - size * 0.04).toString());

	filterPxl.setAttribute("x", shift.toString());
	filterPxl.setAttribute("y", shift.toString());
	filterPxl.setAttribute("width", pxl.toString());
	filterPxl.setAttribute("height", pxl.toString());

	filterCs.setAttribute("width", size.toString());
	filterCs.setAttribute("height", size.toString());

	filterCsImg.setAttribute("width", size.toString());
	filterCsImg.setAttribute("height", size.toString());
	// filterCsImg2.setAttribute("width", size.toString());
	// filterCsImg2.setAttribute("height", size.toString());

	moveStep = size;
}

changeSize(SIZE);

function magnetic(array, value, range = 10) {
	for (let i = 0; i < array.length; i++) {
		const magnetValue = array[i];
		const magnetMax = magnetValue + range;
		const magnetMin = magnetValue - range;

		if (value < magnetMax && value > magnetMin) return magnetValue;
	}

	return value;
}

              
            
!
999px

Console