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#button.svg-icon(
	version="1.1",
	xmlns="http://www.w3.org/2000/svg",
	xmlns:xlink="http://www.w3.org/1999/xlink",
	x="0px",
	y="0px",
	viewBox="0 0 122.88 65.79",
	style="enable-background: new 0 0 122.88 65.79",
	xml:space="preserve"
)
	g
		path.st0(
			d="M13.37,31.32c-22.23,12.2,37.65,19.61,51.14,19.49v-7.44l11.21,11.2L64.51,65.79v-6.97 C37.4,59.85-26.41,42.4,11.97,27.92c0.36,1.13,0.8,2.2,1.3,3.2L13.37,31.32L13.37,31.32z M108.36,8.31c0-2.61,0.47-4.44,1.41-5.48 c0.94-1.04,2.37-1.56,4.3-1.56c0.92,0,1.69,0.12,2.28,0.34c0.59,0.23,1.08,0.52,1.45,0.89c0.38,0.36,0.67,0.75,0.89,1.15 c0.22,0.4,0.39,0.87,0.52,1.41c0.26,1.02,0.38,2.09,0.38,3.21c0,2.49-0.42,4.32-1.27,5.47c-0.84,1.15-2.29,1.73-4.36,1.73 c-1.15,0-2.09-0.19-2.8-0.55c-0.71-0.37-1.3-0.91-1.75-1.62c-0.33-0.51-0.59-1.2-0.77-2.07C108.45,10.34,108.36,9.38,108.36,8.31 L108.36,8.31z M26.47,10.49l-9-1.6c0.75-2.86,2.18-5.06,4.31-6.59C23.9,0.77,26.91,0,30.8,0c4.47,0,7.69,0.83,9.69,2.5 c1.99,1.67,2.98,3.77,2.98,6.29c0,1.48-0.41,2.82-1.21,4.01c-0.81,1.2-2.02,2.25-3.65,3.15c1.32,0.33,2.34,0.71,3.03,1.15 c1.14,0.7,2.02,1.63,2.65,2.77c0.63,1.15,0.95,2.51,0.95,4.1c0,2-0.52,3.91-1.56,5.75c-1.05,1.83-2.55,3.24-4.51,4.23 c-1.96,0.99-4.54,1.48-7.74,1.48c-3.11,0-5.57-0.37-7.36-1.1c-1.8-0.73-3.28-1.8-4.44-3.22c-1.16-1.41-2.05-3.19-2.67-5.33 l9.53-1.27c0.38,1.92,0.95,3.26,1.74,4.01c0.78,0.74,1.78,1.12,3,1.12c1.27,0,2.33-0.47,3.18-1.4c0.85-0.93,1.27-2.18,1.27-3.74 c0-1.59-0.41-2.82-1.22-3.69c-0.81-0.87-1.92-1.31-3.32-1.31c-0.74,0-1.77,0.18-3.07,0.56l0.49-6.81c0.52,0.08,0.93,0.12,1.22,0.12 c1.23,0,2.26-0.4,3.08-1.19c0.82-0.79,1.24-1.72,1.24-2.81c0-1.05-0.31-1.88-0.93-2.49c-0.62-0.62-1.48-0.93-2.55-0.93 c-1.12,0-2.02,0.34-2.72,1.01C27.19,7.62,26.72,8.8,26.47,10.49L26.47,10.49z M75.15,8.27l-9.48,1.16 c-0.25-1.32-0.66-2.24-1.24-2.78c-0.59-0.54-1.31-0.81-2.16-0.81c-1.54,0-2.74,0.77-3.59,2.33c-0.62,1.13-1.09,3.52-1.38,7.19 c1.14-1.16,2.31-2.01,3.5-2.56c1.2-0.55,2.59-0.83,4.16-0.83c3.06,0,5.64,1.09,7.75,3.27c2.11,2.19,3.17,4.96,3.17,8.31 c0,2.26-0.53,4.32-1.6,6.2c-1.07,1.87-2.55,3.29-4.44,4.25c-1.9,0.96-4.27,1.44-7.13,1.44c-3.43,0-6.18-0.58-8.25-1.76 c-2.07-1.17-3.73-3.03-4.97-5.59c-1.24-2.56-1.86-5.95-1.86-10.18c0-6.18,1.3-10.71,3.91-13.59C54.13,1.44,57.74,0,62.36,0 c2.73,0,4.88,0.31,6.46,0.94c1.58,0.63,2.9,1.56,3.94,2.76C73.81,4.92,74.61,6.44,75.15,8.27L75.15,8.27z M57.62,23.55 c0,1.86,0.47,3.31,1.4,4.36c0.94,1.05,2.08,1.58,3.44,1.58c1.25,0,2.3-0.48,3.14-1.43c0.84-0.95,1.26-2.37,1.26-4.26 c0-1.93-0.44-3.41-1.31-4.42c-0.88-1.01-1.96-1.52-3.26-1.52c-1.32,0-2.44,0.49-3.34,1.48C58.06,20.32,57.62,21.72,57.62,23.55 L57.62,23.55z M77.91,17.57c0-6.51,1.17-11.07,3.52-13.67C83.77,1.3,87.35,0,92.14,0c2.31,0,4.2,0.29,5.68,0.85 c1.48,0.57,2.69,1.31,3.62,2.22c0.94,0.91,1.68,1.87,2.21,2.87c0.54,1.01,0.97,2.18,1.3,3.52c0.64,2.55,0.96,5.22,0.96,8 c0,6.22-1.05,10.76-3.16,13.64c-2.1,2.88-5.72,4.32-10.87,4.32c-2.88,0-5.21-0.46-6.99-1.38c-1.78-0.92-3.23-2.27-4.37-4.05 c-0.82-1.26-1.47-2.98-1.93-5.17C78.14,22.64,77.91,20.22,77.91,17.57L77.91,17.57z M87.34,17.59c0,4.36,0.38,7.34,1.16,8.94 c0.77,1.6,1.89,2.39,3.36,2.39c0.97,0,1.8-0.34,2.51-1.01c0.71-0.68,1.23-1.76,1.56-3.22c0.34-1.47,0.5-3.75,0.5-6.85 c0-4.55-0.38-7.6-1.16-9.18c-0.77-1.56-1.93-2.35-3.47-2.35c-1.58,0-2.71,0.8-3.42,2.39C87.69,10.31,87.34,13.27,87.34,17.59 L87.34,17.59z M112.14,8.32c0,1.75,0.15,2.94,0.46,3.58c0.31,0.64,0.76,0.96,1.35,0.96c0.39,0,0.72-0.13,1.01-0.41 c0.28-0.27,0.49-0.7,0.63-1.29c0.13-0.59,0.2-1.5,0.2-2.74c0-1.82-0.15-3.05-0.46-3.68c-0.31-0.63-0.77-0.94-1.39-0.94 c-0.63,0-1.09,0.32-1.37,0.96C112.28,5.4,112.14,6.59,112.14,8.32L112.14,8.32z M109.3,30.23c10.56,5.37,8.04,12.99-10.66,17.62 c-5.3,1.31-11.29,2.5-17.86,2.99v6.05c7.31-0.51,14.11-2.19,20.06-3.63c28.12-6.81,27.14-18.97,9.36-25.83 C109.95,28.42,109.65,29.35,109.3,30.23L109.3,30.23z"
		)
#h.main.flex
	.shadow
	.cylinder
		.circle.flex
			.circle-a 
				- var n = 0;
				while n < 30
					.circle-a__side
					- n++;
				//- div.circle-a__bottom
				.circle-a__top
	.cylinder2
		.circle.flex
			.circle-b 
				- var n = 0;
				while n < 30
					.circle-b__side
					- n++;
				//- div.circle-b__bottom
				.circle-b__top

	.sphere.flex
		- var i = 1;
		while i < 12
			div(class='sphere-item' + i)
				- var f = 0;
				while f < 30
					div(class='sphere-item' + i + '__side')
					- f++;
			- i++;

              
            
!

CSS

              
                $unit-s: 3vmin;

$bg-1: #7a74de;
$bg-2: darken($bg-1, 8);
$red: #fa2c34;
$black: #27282d;
$white: #e5e7f1;
$neon: #c0f5f5;
/***********************/
@mixin cylinder($base, $sides, $degree, $pi, $width, $color) {
	display: flex;
	justify-content: center;
	align-items: center;
	position: absolute;

	&__side {
		position: absolute;
		height: (2 * $pi * ($base / 2)) / $sides;
		width: $width;
		background-color: darken($color, 15);

		@for $var from 1 to ($sides + 1) {
			&:nth-of-type(#{$var}) {
				transform: rotateX($var * $degree / $sides) translateZ($base / 2);
			}
		}
		@for $var from 1 to 16 {
			&:nth-of-type(#{$var}) {
				background-color: darken($color, $var * 1.5);
			}
		}
		@for $var from 1 to 16 {
			&:nth-last-of-type(#{$var}) {
				background-color: darken($color, $var * 1.5);
			}
		}
	}
	&__top,
	&__bottom {
		position: absolute;
		width: $base;
		height: $base;
		transform: rotateY(90deg) translateZ($width / 2);
		border-radius: 50%;
	}
	&__bottom {
		transform: rotateY(90deg) translateZ($width / -2);
	}
}

@mixin sphere($base, $sides, $degree, $pi, $width, $y, $color) {
	display: flex;
	justify-content: center;
	align-items: center;
	position: absolute;

	&__side {
		position: absolute;
		height: (2 * $pi * ($base / 2)) / $sides;
		width: $width;
		background-color: darken($color, 15);

		@for $var from 1 to ($sides + 1) {
			&:nth-of-type(#{$var}) {
				transform: rotateX($var * $degree / $sides)
					translateZ($base / 2)
					rotateY($y);
			}
		}
		@for $var from 1 to 16 {
			&:nth-of-type(#{$var}) {
				background-color: darken($color, $var * 1.5);
			}
		}

		@for $var from 1 to 16 {
			&:nth-last-of-type(#{$var}) {
				background-color: darken($color, $var * 1.5);
			}
		}
	}
}
/***********************/
/***********************/
*,
*::after,
*::before {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	transform-style: preserve-3d;

	user-select: none;
	-webkit-tap-highlight-color: transparent;
	appearance: none;
	font-family: "Press Start 2P", cursive;
}
/***********************/
/***********************/
body {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	width: 100%;

	font-weight: bolder;
	overflow: hidden;
	cursor: pointer;
	background-color: $bg-1;
}
.face {
	position: absolute;
}
.flex {
	display: flex;
	justify-content: center;
	align-items: center;
}
/***********************/
/***********************/
// .s{
//     position: fixed;
//     width: 15.25 * $unit-s;
//     height: 15.25 * $unit-s;
//     outline: 1 * $unit-s solid lime;
//     border-radius: 50%;
// }
.main,
.sphere {
	position: absolute;
	width: 15 * $unit-s;
	height: 15 * $unit-s;
}
.main {
	transform: perspective(400 * $unit-s) rotateX(70deg) rotateZ(0)
		translateZ(-7 * $unit-s);
	transition: transform 200ms ease-out;
}
.is-button-active {
	animation: is-button-active 4000ms linear infinite;
}
.is-button-hidden {
	display: none;
}
@keyframes is-button-active {
	to {
		transform: perspective(400 * $unit-s) rotateX(70deg) rotateZ(1turn)
			translateZ(-7 * $unit-s);
	}
}

.svg-icon {
	position: absolute;
	left: 50%;
	bottom: 50px;
	width: 50px;
	height: 50px;

	z-index: 2000;
	opacity: 0.65;
	transform: translateX(-50%);
	cursor: pointer;

	&:hover {
		opacity: 0.9;
	}
}
.svg-icon path,
.svg-icon polygon,
.svg-icon rect {
	fill: white;
}
.svg-icon circle {
	stroke: white;
	stroke-width: 1;
}

.shadow {
	position: absolute;
	width: 100%;
	height: 100%;
	transform: translateZ(-0.5 * $unit-s);
	border-radius: 50%;
	background-image: radial-gradient(
		darken($bg-2, 20),
		darken($bg-2, 10),
		$bg-2 60%
	);
	filter: blur(0.4 * $unit-s);

	&::before {
		content: "";
		position: absolute;
		bottom: -16 * $unit-s;
		left: 5 * $unit-s;
		width: 5 * $unit-s;
		height: 10 * $unit-s;

		filter: blur(0.5 * $unit-s);
		border-radius: 50%;
		background-image: linear-gradient(
			to bottom,
			rgba($neon, 0.3),
			rgba($neon, 0.05)
		);
	}
}

.sphere {
	$sides: 30;
	$degree: 360deg;
	$width: 2 * $unit-s;

	&::before,
	&::after {
		content: "";
		position: absolute;
		width: 2 * $unit-s;
		height: 2 * $unit-s;
		border-radius: 50%;

		background-image: linear-gradient(
			to left,
			darken($white, 10),
			darken($white, 20)
		);
		transform: translateZ(-0.49 * $unit-s);
	}

	&::after {
		transform: translateZ(14.5 * $unit-s);
		background-image: linear-gradient(
			to left,
			darken($red, 10),
			darken($red, 10)
		);
	}

	&-item1 {
		$base: 3.75 * $unit-s;
		$pi: 5;
		$y: 75deg;

		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(0.2125 * $unit-s);
		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($white, 13));
		&__side {
			clip-path: polygon(0 0, 100% 27%, 100% 73%, 0% 100%);
		}
	}
	&-item2 {
		$base: 7.35 * $unit-s;
		$pi: 4;
		$y: 60deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-0.55 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($white, 10));
		&__side {
			clip-path: polygon(0 0, 100% 16%, 100% 86%, 0% 100%);
		}
	}
	&-item3 {
		$base: 10.45 * $unit-s;
		$pi: 3.73;
		$y: 48deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-1.7 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($white, 7));
		&__side {
			clip-path: polygon(0 0, 100% 13%, 100% 87%, 0% 100%);
		}
	}
	&-item4 {
		$base: 12.825 * $unit-s;
		$pi: 3.6;
		$y: 28deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-3.2 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($white, 3));
		&__side {
			clip-path: polygon(0 0, 100% 8%, 100% 92%, 0% 100%);
		}
	}
	&-item5 {
		$base: 14.2 * $unit-s;
		$pi: 3.45;
		$y: 15deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-5 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, $white);
		&__side {
			clip-path: polygon(0 0, 100% 5%, 100% 95%, 0% 100%);
		}
	}
	// ======
	// ======
	&-item6 {
		$base: 14.35 * $unit-s;
		$pi: 3.3;
		$y: 0deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-7 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, $black);
	}
	// ======
	// ======
	&-item7 {
		$base: 14.2 * $unit-s;
		$pi: 3.45;
		$y: -15deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-8.95 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($red, 5));
		&__side {
			clip-path: polygon(0 5%, 100% 0%, 100% 100%, 0% 95%);
		}
	}
	&-item8 {
		$base: 12.825 * $unit-s;
		$pi: 3.6;
		$y: -28deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-10.8 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($red, 3));
		&__side {
			clip-path: polygon(0 8%, 100% 0%, 100% 100%, 0% 92%);
		}
	}
	&-item9 {
		$base: 10.45 * $unit-s;
		$pi: 3.73;
		$y: -48deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-12.35 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($red, 2));
		&__side {
			clip-path: polygon(0 13%, 100% 0%, 100% 100%, 0% 87%);
		}
	}
	&-item10 {
		$base: 7.35 * $unit-s;
		$pi: 4;
		$y: -60deg;
		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-13.5 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, darken($red, 2));
		&__side {
			clip-path: polygon(0 14%, 100% 0%, 100% 100%, 0% 86%);
		}
	}
	&-item11 {
		$base: 3.75 * $unit-s;
		$pi: 5;
		$y: -75deg;

		position: absolute;
		width: $width;
		height: $base;
		transform: rotateY(90deg) translateX(-14.25 * $unit-s);

		@include sphere($base, $sides, $degree, $pi, $width, $y, $red);
		&__side {
			clip-path: polygon(0 28%, 100% 0, 100% 100%, 0 73%);
		}
	}
}
.cylinder {
	position: absolute;
	width: 5 * $unit-s;
	height: 5 * $unit-s;

	transform: translateZ(9.5 * $unit-s) rotateX(90deg);
	bottom: -2.5 * $unit-s;
	left: 4.85 * $unit-s;

	.circle {
		$sides: 30;
		$degree: 360deg;
		$width: 5 * $unit-s;

		&-a {
			$base: 5 * $unit-s;
			$pi: 3.5;

			width: $width;
			height: $base;
			transform: rotateY(90deg) translateX(-50%);

			@include cylinder($base, $sides, $degree, $pi, $width, $black);

			&__top {
				background-image: radial-gradient($neon, darken($neon, 15));
				border: 0.6 * $unit-s solid $black;
			}
		}
	}
}
.cylinder2 {
	position: absolute;
	width: 3.5 * $unit-s;
	height: 3.5 * $unit-s;

	transform: translateZ(8.7 * $unit-s) rotateX(90deg);
	bottom: -2 * $unit-s;
	left: 5.625 * $unit-s;

	.circle {
		$sides: 30;
		$degree: 360deg;
		$width: 3.5 * $unit-s;

		&-b {
			$base: 3.5 * $unit-s;
			$pi: 3.5;

			position: absolute;
			width: $width;
			height: $base;
			transform: rotateY(90deg) translateX(-50%);

			@include cylinder($base, $sides, $degree, $pi, $width, $black);

			&__top {
				background-image: radial-gradient($neon, darken($neon, 15));
				border: 0.25 * $unit-s solid $black;
				box-shadow: 0 0 1 * $unit-s rgba($neon, 0.65);
			}
		}
	}
}

              
            
!

JS

              
                const b = document.body;
const h = document.querySelector("#h");
const unit = 3;
const button = document.querySelector("#button");

/*****************/
const mouseDownFunc = () => b.addEventListener("mousemove", moveFunc);
const mouseUpFunc = () => b.removeEventListener("mousemove", moveFunc);
const moveFunc = (e) => {
	let x = e.pageX / window.innerWidth - 0.5;
	let y = e.pageY / window.innerHeight - 0.5;

	h.style.transform = `
        perspective(${400 * unit}vmin)
        rotateX(${y * 30 + 70}deg)
        rotateZ(${-x * 720 + 40}deg)
        translateZ(${-7 * unit}vmin)
    `;
};

const animationFunc = () => h.classList.toggle("is-button-active");
/*****************/
h.addEventListener("mousedown", mouseDownFunc);
b.addEventListener("mouseup", mouseUpFunc);

if (
	/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
		navigator.userAgent
	)
) {
	button.addEventListener("click", animationFunc);
	button.classList.remove("is-button-hidden");
} else {
	button.removeEventListener("click", animationFunc);
	button.classList.add("is-button-hidden");
}

              
            
!
999px

Console