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

              
                - let divz = 0;
while divz < 99
	.dragon
	- divz++;
.dragon
	svg(
		width="100%",
		height="100%",
		viewbox="0 0 181 167",
		version="1.1",
		xmlns="http://www.w3.org/2000/svg",
		xmlns:xlink="http://www.w3.org/1999/xlink",
		xml:space="preserve",
		xmlns:serif="http://www.serif.com/",
		style="fill-rule:nonzero;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"
	)
		rect#Artboard1(
			x="0",
			y="0",
			width="180.094",
			height="166.453",
			style="fill:none;"
		)
		g
			path.darker(
				d="M63.272,51.933c0,0 -18.2,-23.721 -40.833,-34.579c0,0 14.643,26.345 1.064,29.105c0,0 10.377,19.396 -2.406,32.381c0,0 21.251,-3.793 27.861,-0.206l14.314,-26.701Z"
			)
			path.base(
				d="M61.197,48.097c0,0 -24.221,-28.73 -37.486,-32.622l-1.272,1.879c0,0 21.824,11.175 36.595,32.722l2.163,-1.979Z"
			)
			path.base(
				d="M23.503,46.459c0,0 26.561,8.808 30.614,15.295l-1.571,2.884l-29.043,-18.179Z"
			)
			path.darker(
				d="M121.169,51.933c0,0 18.201,-23.721 40.834,-34.579c0,0 -14.644,26.345 -1.065,29.105c0,0 -10.376,19.396 2.407,32.381c0,0 -21.251,-3.793 -27.862,-0.206l-14.314,-26.701Z"
			)
			path.base(
				d="M123.245,48.097c0,0 24.221,-28.73 37.485,-32.622l1.273,1.879c0,0 -21.825,11.175 -36.596,32.722l-2.162,-1.979Z"
			)
			path.base(
				d="M160.938,46.459c0,0 -26.561,8.808 -30.613,15.295l1.57,2.884l29.043,-18.179Z"
			)
			path.darker(
				d="M109.515,101.952c0,0 28.939,0.199 50.537,11.33c0,0 -27.36,12.016 -24.903,24.773c0.073,-0.289 -22.694,-7.362 -19.564,15.985c0,0 -11.695,-22.438 -18.324,-25.446l12.254,-26.642Z"
			)
			path.darker(
				d="M73.094,102.109c0,0 -28.936,0.449 -50.438,11.766c0,0 27.463,11.779 25.116,24.557c-0.075,-0.289 22.63,-7.557 19.701,15.815c0,0 11.502,-22.538 18.104,-25.603l-12.483,-26.535Z"
			)
			//- path.base(
			//- 	d="M135.132,78.204c-0.097,-22.645 -18.535,-40.925 -41.181,-40.827l-7.955,0.034c-22.646,0.098 -40.925,18.535 -40.828,41.182l0.025,5.647c0.098,22.647 18.535,40.925 41.182,40.827l7.954,-0.034c22.646,-0.097 40.925,-18.535 40.827,-41.18l-0.024,-5.649Z"
			//- )
			path.subtle(
				d="M44.616,106.056c0.061,14.267 21.287,25.741 47.411,25.629c26.122,-0.113 47.249,-11.77 47.187,-26.038c-0.061,-14.266 -19.518,-16.092 -45.64,-15.98c-26.123,0.113 -49.02,2.121 -48.958,16.389Z"
			)
			path(
				d="M71.996,90.257c-0.357,-0.216 -0.698,-0.466 -1.024,-0.747c0.383,0.227 0.727,0.478 1.024,0.747Z"
			)
			path(
				d="M117.415,106.877c0,0 6.047,7.385 3.107,8.818c-2.939,1.434 -9.329,-3.761 -9.329,-3.761",
				style="fill:#fff"
			)
			path(
				d="M67.579,107.093c0,0 -5.984,7.436 -3.032,8.845c2.952,1.407 9.297,-3.843 9.297,-3.843",
				style="fill:#fff"
			)
			path(
				d="M118.064,104.5l-0.001,0.001c-0.069,0.105 -2.036,3.028 -6.36,5.923c-4.327,2.894 -10.998,5.775 -20.587,5.819l-0.207,0.001c-9.654,-0.007 -15.237,-2.911 -18.461,-5.739c-1.611,-1.417 -2.63,-2.827 -3.244,-3.872c-0.308,-0.522 -0.513,-0.953 -0.639,-1.246c-0.063,-0.146 -0.106,-0.258 -0.133,-0.33l-0.027,-0.076l-0.005,-0.014l-0.218,0.071l0.219,-0.069l-0.001,-0.002l-0.218,0.071l0.219,-0.069c-0.165,-0.527 -0.726,-0.82 -1.253,-0.655c-0.527,0.166 -0.821,0.727 -0.655,1.254c0.036,0.115 1.05,3.282 4.634,6.439c3.581,3.159 9.729,6.244 19.782,6.237l0.215,-0.001c10.15,-0.041 17.311,-3.167 21.909,-6.304c4.602,-3.137 6.655,-6.268 6.707,-6.347c0.301,-0.463 0.17,-1.083 -0.292,-1.384c-0.463,-0.301 -1.083,-0.171 -1.384,0.292Z",
				style="fill:#1a1a1a;fill-rule:nonzero;"
			)
			path(
				d="M94.692,100.489c0.012,1.968 0.942,3.561 2.076,3.557c1.135,-0.003 2.045,-1.601 2.034,-3.569c-0.013,-1.968 -0.942,-3.561 -2.077,-3.557c-1.135,0.004 -2.045,1.601 -2.033,3.569Z",
				style="fill:#1a1a1a;fill-rule:nonzero;"
			)
			path(
				d="M88.482,100.614c0.012,1.968 0.942,3.561 2.076,3.557c1.135,-0.003 2.045,-1.601 2.034,-3.569c-0.013,-1.968 -0.942,-3.561 -2.077,-3.557c-1.135,0.004 -2.045,1.601 -2.033,3.569Z",
				style="fill:#1a1a1a;fill-rule:nonzero;"
			)
			path.darker(
				d="M67.306,38.185l6.612,6.669c0.669,0.674 0.357,1.821 -0.562,2.063l-9.083,2.392c-0.918,0.242 -1.755,-0.602 -1.505,-1.519l2.47,-9.061c0.249,-0.917 1.398,-1.219 2.068,-0.544l6.612,6.669c0.669,0.674 0.357,1.821 -0.562,2.063l-9.083,2.392c-0.918,0.242 -1.755,-0.602 -1.505,-1.519l2.47,-9.061c0.249,-0.917 1.398,-1.219 2.068,-0.544Z"
			)
			path.darker(
				d="M119.588,38.836l-0.04,9.392c-0.004,0.95 -1.035,1.54 -1.857,1.061l-8.112,-4.73c-0.822,-0.48 -0.817,-1.667 0.008,-2.139l8.154,-4.661c0.825,-0.472 1.852,0.127 1.847,1.077l-0.04,9.392c-0.004,0.95 -1.035,1.54 -1.857,1.061l-8.112,-4.73c-0.822,-0.48 -0.817,-1.667 0.008,-2.139l8.154,-4.661c0.825,-0.472 1.852,0.127 1.847,1.077Z"
			)
			path.darker(
				d="M92.642,43.195l4.797,8.074c0.486,0.817 -0.095,1.853 -1.045,1.865l-9.391,0.118c-0.95,0.013 -1.557,-1.009 -1.093,-1.838l4.593,-8.192c0.465,-0.829 1.653,-0.844 2.139,-0.027l4.797,8.074c0.486,0.817 -0.095,1.853 -1.045,1.865l-9.391,0.118c-0.95,0.013 -1.557,-1.009 -1.093,-1.838l4.593,-8.192c0.465,-0.829 1.653,-0.844 2.139,-0.027Z"
			)
			path.darker(
				d="M92.589,31.099l4.798,8.073c0.486,0.817 -0.095,1.853 -1.045,1.865l-9.391,0.119c-0.951,0.012 -1.557,-1.01 -1.093,-1.839l4.593,-8.191c0.465,-0.829 1.653,-0.845 2.138,-0.027l4.798,8.073c0.486,0.817 -0.095,1.853 -1.045,1.865l-9.391,0.119c-0.951,0.012 -1.557,-1.01 -1.093,-1.839l4.593,-8.191c0.465,-0.829 1.653,-0.845 2.138,-0.027Z"
			)
			path(
				d="M74.6,87.679c0.202,-1.425 0.034,-6.426 2.774,-5.058c1.841,0.921 2.437,3.261 4.011,4.49c0.281,0.22 0.767,0.096 0.88,-0.254c0.985,-3.028 -2.615,-7.388 -5.755,-7.212c-3.666,0.206 -5.246,5.462 -3.603,8.296c0.425,0.732 1.563,0.663 1.693,-0.262Z",
				style="fill:#1a1a1a;fill-rule:nonzero;"
			)
			path(
				d="M109.613,87.158c-0.302,-1.408 -0.487,-6.408 -3.124,-4.85c-1.772,1.048 -2.201,3.425 -3.684,4.762c-0.265,0.239 -0.758,0.15 -0.896,-0.192c-1.195,-2.951 2.088,-7.554 5.233,-7.599c3.671,-0.053 5.617,5.079 4.178,8.021c-0.372,0.761 -1.512,0.771 -1.707,-0.142Z",
				style="fill:#1a1a1a;fill-rule:nonzero;"
			)
h1 ✨ move mouse or drag to make me fly ✨

              
            
!

CSS

              
                body {
	position: relative;
	background: #0b1223;
	height: 100vh;
	cursor: none;
	touch-action: none;
}

.dragon {
	position: absolute;
	background-color: #fff;
	border-radius: 999px;
	-webkit-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.dragon:nth-of-type(100) {
	display: flex;
	justify-content: center;
	align-items: center;
}

.dragon svg {
	position: absolute;
	width: 170%;
	height: 170%;
}

:root {
	--hue: 200;
}

.darker {
	fill: hsl(var(--complementary), 60%, 80%);
}

.base {
	fill: hsl(var(--hue), 60%, 80%);
}

.subtle {
	fill: hsl(var(--hue), 50%, 70%);
}

@for $i from 1 through 100 {
	.dragon:nth-child(#{$i}) {
		width: 20px + $i / 1.5;
		height: 20px + $i / 1.5;
		--width: 20px + $i / 1.5;
		--height: 13px + $i / 1.5;
		--bg: hsl(var(--hue), 60%, 80%);
		--light: hsl(var(--hue), 90%, 100%);
		background-color: var(--bg);
	}

	.dragon:nth-child(#{$i}):before {
		content: "";
		position: absolute;
		top: -10px;
		left: 50%;
		transform: translateX(-50%);
		width: 0;
		height: 0;
		border-left: $i / 8 * 1px solid transparent;
		border-right: $i / 8 * 1px solid transparent;
		border-radius: 10%;
		border-bottom: 15px solid hsl(var(--complementary), 80%, 90%);
	}

	// 	.dragon:nth-child(#{$i}):after {
	// 		content: "";
	// 		position: absolute;
	// 		left: 50%;
	// 		bottom: 0;
	// 		width: 90%;
	// 		height: 50%;
	// 		background-color: white;
	// 		opacity: 0.4;
	// 		border-radius: 50%;
	// 		transform: translateX(-50%);
	// 	}
}

.dragon:nth-child(100):after {
	content: none;
}

.dragon:nth-child(10n) {
	background-color: var(--bg);
	background-image: repeating-radial-gradient(
		circle at 0.5em 0,
		var(--bg) 0.4em,
		hsla(0, 100%, 100%, 0.6) 0.45em,
		hsla(0, 100%, 100%, 0.6) 0.5em,
		hsla(0, 100%, 100%, 0) 0.51em,
		hsla(0, 100%, 100%, 0) 3em
	);
	background-size: 1em 0.5em;
}

.dragon:nth-child(100) {
	background-color: var(--bg);
	background-image: repeating-radial-gradient(
		circle at 0.5em 0,
		var(--bg) 0.4em,
		hsla(0, 100%, 100%, 0.3) 0.45em,
		hsla(0, 100%, 100%, 0.3) 0.5em,
		hsla(0, 100%, 100%, 0) 0.51em,
		hsla(0, 100%, 100%, 0) 3em
	);
	background-size: 1em 0.5em;
}

.dragon:not(:nth-child(10n + 1)):before {
	content: none;
}

h1 {
	color: #fff;
	font-size: 0.9rem;
	margin-top: 1rem;
	text-align: center;
	position: fixed;
	top: 0;
	width: 100vw;
	left: 0;
	font-family: Futura, Trebuchet MS, Arial, sans-serif;
}

              
            
!

JS

              
                var dragonSegments = [...document.querySelectorAll(".dragon")];
dragonSegments.reverse();
var startPos = { x: window.innerWidth / 2, y: window.innerHeight / 2 };
var mouse = { x: startPos.x, y: startPos.y };
var speed = 0.6;
let root = document.documentElement;

let hue = Math.floor(Math.random() * 360);
let complementary = hue + 100;

root.style.setProperty("--hue", hue);
root.style.setProperty("--complementary", complementary);

dragonSegments.forEach((segment, index) => {
	segment.x = startPos.x;
	segment.y = startPos.y;

	let newHue = hue + index;
	segment.style.setProperty("--hue", newHue);
});

// set initial position
gsap.set(".dragon", {
	x: startPos.x,
	y: startPos.y,
	xPercent: -50,
	yPercent: -50
});

window.addEventListener("mousemove", (e) => {
	mouse.x = e.x;
	mouse.y = e.y;
});

window.addEventListener("touchmove", (e) => {
	var poke = e.changedTouches[0];
	mouse.x = poke.clientX;
	mouse.y = poke.clientY;
});

function trail(follower, leader) {
	follower.x += (leader.x - follower.x) * speed;
	follower.y += (leader.y - follower.y) * speed;

	gsap.set(follower, {
		x: follower.x,
		y: follower.y
	});
}

gsap.ticker.add(() => {
	dragonSegments.forEach((segment, i) => {
		let previousSegment = dragonSegments[i - 1];

		if (i === 0) {
			trail(segment, mouse);
		} else {
			trail(segment, previousSegment);
		}
	});
});

              
            
!
999px

Console