Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              - var n = 5;
- var max = 65, val = 0;

section.scene(style=`--fx: ${val}; --max: ${max}`)
	.rot
		.s3d.j6
			- for(var i = 0; i < n; i++)
				.s2d.j6__face.lat.s3gon.dir
				.s2d.j6__face.lat.s5gon.dir
			- for(var i = 0; i < n; i++)
				.s2d.j6__face.lat.s3gon.rev
			.s2d.j6__face.base.up(class=`s${n}gon`)
	.rot
		.s3d.j6.points
			- for(var i = 0; i < 3*n; i++)
				.pos.mid(class=i < 2*n ? 'dn' : 'up'): .s1d
				.pos.end(class=i < 2*n ? 'dn' : 'up'): .s1d
	form
		input#a0(type='range' min=-max max=max value=val)
		label(for='a0')
			span.token--func rotatex
			span.token--punc (
			span.token--arg.token--ang
				span.token--num
				span.token--unit deg
			span.token--punc )
		input#p0(type='checkbox')
		label(for='p0') Playing
			

section.scene(style=`--fx: ${val}; --max: ${max}`)
	.rot
		.s3d.ap10
			- for(var i = 0; i < 2*n; i++)
				.s2d.ap10__face.lat.s3gon.dir
				.s2d.ap10__face.lat.s3gon.rev
			.s2d.ap10__face.base.dn(class=`s${2*n}gon`)
	.rot
		.s3d.ap10.points
			- for(var i = 0; i < 4*n; i++)
				.pos.mid(class=i < 2*n ? 'dn' : 'up'): .s1d
				.pos.end(class=i < 2*n ? 'dn' : 'up'): .s1d
	form
		input#a1(type='range' min=-max max=max value=val)
		label(for='a1')
			span.token--func rotatex
			span.token--punc (
			span.token--arg.token--ang
				span.token--num
				span.token--unit deg
			span.token--punc )
		input#p1(type='checkbox')
		label(for='p1') Playing
		
            
          
!

CSS

            
              // GEOMETRY
$g: .625em; // scene gap
$l: 12.25vmin; // edge length
$n: 5; // gyroelongated rotunda type (5 = pentagonal)
// lateral face heights
$h3gon: poly-h($l, 3);
$h5gon: poly-h($l, 5);
// pentagonal diagonal
$d5gon: 2*$l*sin(.5*vx-ang(5));
// base planes
$ba-b0: bc-ang($n); // top base central angle
$ri-b0: in-rad($l, $ba-b0); // top base inradius
$rc-b0: cc-rad($l, $ba-b0); // top base circumradius
$ba-b1: bc-ang(2*$n); // bottom base central angle
$ri-b1: in-rad($l, $ba-b1); // bottom base inradius
$rc-b1: cc-rad($l, $ba-b1); // bottom base circumradius
// mid plane
$rc-m: cc-rad($d5gon, $ba-b0);
// lateral face angles with the vertical
$rax3-mid: to-deg(asin(($rc-b1 - $ri-b1)/$h3gon));
$rax3-cup-dn: to-deg(asin(($ri-b1 - $rc-m)/$h3gon));
$rax3-cup-up: to-deg(asin(($ri-b0 - $rc-m)/$h3gon));
$rax5: to-deg(asin(($ri-b1 - $rc-b0)/$h5gon));

// face background & edge data
$clst: #ff8a00 #da1b60 #9c27b0;
$flst: 3 $n 2*$n;
$llen: length($flst);
$lw: 4px;
$lc: #8bc34a;
$ec: #03a9f4;

$bg: #262626;
$fg: #e7e7e7;
$hl: #f44336;

$thumb-d: 1.25em;
$track-w: 9em;
$track-h: .25em;
$input-h: $thumb-d + 2*$track-h;

$check-d: 1.522em;
$dc: #f44336;

$t: 9s;

@mixin poly($n, $ba) {
	--rc: #{cc-rad($l, $ba)};
	--ri: #{in-rad($l, $ba)};
	--poly: #{polygon(get-poly-points($n))};
	
	&:before { --poly: #{polygon(get-poly-points($n, $bw: $lw))} }
}

@mixin track() {
	width: 100%; height: $track-h;
	border-radius: $track-h;
	background-color: $fg;
	background: radial-gradient(circle at var(--pos) 50%, transparent .5*$thumb-d, $fg 0)
}

@mixin thumb() {
	width: $thumb-d; height: $thumb-d;
	border-radius: 50%;
	transform: scale(calc(1 - var(--nothl)*.39));
	background: $hl;
	filter: grayScale(var(--nothl)) brightness(calc(1 + 1.5*var(--nothl)));
	transition: .3s
}

* { margin: 0; font: inherit }

body {
	box-sizing: border-box;
	display: grid;
	grid-template: 1fr/ 1fr 1fr;
	grid-gap: $g;
	overflow: hidden;
	padding: $g;
	min-height: 100vh;
	background: $bg;
	color: $fg;
	
	@media (orientation: portrait) {
		grid-template: 1fr 1fr/ 1fr
	}
}

.scene {
	--ax: calc(var(--fx)*1deg);
	display: flex;
	justify-content: center;
	position: relative;
	perspective: 25em;
	box-shadow: 0 0 0 1px;
	
	&:not(.playing) {
		*, :before, :after { animation-play-state: paused }
	}
}

div {
	--notk: calc(1 - var(--k));
	--sgnk: calc(1 - 2*var(--k));
	--noti: calc(1 - var(--i));
	--sgni: calc(1 - 2*var(--i));
	position: absolute;
	transform-style: preserve-3d;
}

.rot {
	top: 50%; left: 50%;
	transform: rotatex(var(--ax))
}

.s3d {
	animation: r $t linear infinite;
	
	&:not(.points):after {
		--sgn: calc(2*var(--s) - 1);
		position: absolute;
		margin: -$rc-b1;
		padding: $rc-b1;
		transform: 
			rotatey(calc(var(--s)*#{.5*$ba-b1})) 
			rotatex(calc(var(--sgn)*90deg)) 
			translatez(calc(.5*var(--h)));
		background: $lc;
		--poly: #{polygon(get-poly-points(2*$n, $bw: $lw))};
		-webkit-clip-path: var(--poly);
						clip-path: var(--poly);
		content: ''
	}
}

@keyframes r { to { transform: rotatey(1turn) } }

.j6 { /* pentagonal rotunda */
	--lim: 9;
	--s: 0;
	--h: #{cath1($h5gon, $ri-b1 - $rc-b0)};
	--sf: #{$rc-b0/$ri-b0};
	
	&__face {		
		&.lat {
			transform: 
				rotatey(calc(var(--j)*#{$ba-b1})) 
				translatez(calc(var(--notk)*#{$ri-b1} + var(--k)*#{$ri-b0}))
				rotate(calc(var(--k)*.5turn))
				rotatex(calc(var(--notk)*(var(--i)*#{$rax5} + var(--noti)*#{$rax3-cup-dn}) + var(--k)*#{$rax3-cup-up}));

			@for $j from 0 to 2*$n {
				&.dir:nth-child(#{2*$n}n + #{$j + 1}) { --j: #{$j} }
			}
			
			@for $j from 0 to $n {
				&.rev:nth-child(#{$n}n + #{$j + 1}) { --j: #{2*$j} }
			}
		}
		
		&.base {
			transform: rotatex(90deg) translatez(calc(.5*var(--h)));
		}
	}
	
	.pos {
		--ay: calc(.5*var(--j)*(var(--k)*#{$ba-b1} + var(--notk)*#{$ba-b0}));
		--z: calc(var(--k)*(var(--i)*#{$ri-b1} + var(--noti)*#{$rc-b1}) + 
							var(--notk)*(var(--i)*#{$ri-b0} + var(--noti)*#{$rc-b0}));
		
		@for $j from 0 to 4*$n {
			&.dn:nth-child(#{4*$n}n + #{$j + 1}) { --j: #{$j} }
		}

		@for $j from 0 to 2*$n {
			&.up:nth-child(#{2*$n}n + #{$j + 1}) { --j: #{$j} }
		}
	}
}

.ap10 { /* antiprism */
	--lim: 6;
	--s: 1;
	--h: #{cath1($h3gon, $rc-b1 - $ri-b1)};
	--sf: #{$rc-b1/$ri-b1};
	
	&__face {		
		&.lat {
			transform: 
				rotateY(calc(var(--j)*#{$ba-b1})) 
				translatez($ri-b1)
				rotate(calc(var(--k)*.5turn))
				rotatex(-$rax3-mid);
			
			@for $j from 0 to 4*$n {
				&:nth-child(#{2*$n}n + #{$j + 1}) { --j: calc(#{floor($j/2)} + .5*var(--k)) }
			}
		}
		
		&.base {
			transform: rotateX(-90deg) translatez(calc(.5*var(--h)));
		}
	}

	.pos {
		--ay: calc(.5*(var(--notk) + var(--j))*#{$ba-b1});
		--z: calc(var(--i)*#{$ri-b1} + var(--noti)*#{$rc-b1});
		
		@for $j from 0 to 4*$n {
			&:nth-child(#{4*$n}n + #{$j + 1}) { --j: #{$j} }
		}
	}
}

.s2d {
	--rf: calc(.5*(var(--max) - var(--sgnk)*var(--fx))/var(--max));
	margin: calc(-1*var(--rc));
	padding: var(--rc);
	-webkit-clip-path: var(--poly);
					clip-path: var(--poly);
	
	&:before, &:after {
		position: absolute;
		top: 0; right: 0; bottom: 0; left: 0;
		-webkit-clip-path: var(--poly);
						clip-path: var(--poly);
		content: ''
	}
	
	&:after {
		opacity: .7;
		filter: Invert(calc((var(--fx) - var(--lim))/(var(--max) - var(--lim))))
	}
}

@for $i from 0 to $llen {
	$m: nth($flst, $i + 1);
	
	.s#{$m}gon {
		@include poly($m, bc-ang($m));
		background: rgba(nth($clst, $i + 1), .85)
	}
}

.lat {
	margin-top: calc(.5*var(--sgnk)*var(--h) - var(--rc) - var(--ri));
	transform-origin: 50% calc(50% + var(--ri));
	
	&.s3gon { --i: 0 }
	&.s5gon { --i: 1 }
	
	&:before {
		background: Linear-gradient(rgba(#fff, .5) calc(50% + var(--ri) - #{$lw}), $lc 0);
	}
	
	&:after {
		background: 
			Linear-gradient(hsl(0, 0%, calc(var(--rf)*50%)), 
											hsl(0, 0%, calc((1 - var(--rf))*50%)));
		animation: shade .5*$t linear infinite calc(var(--j)*#{-$t/(2*$n)} - #{$t}) alternate
	}
}

@keyframes shade { 0% { opacity: 0 } }

.base {
	&:before { background: $lc }
	
	&:after {
		transform: scale(var(--sf));
		background: 
			Linear-gradient(calc(var(--notk)*180deg), 
				#000, transparent);
		animation: rr $t linear infinite
	}
}

@keyframes rr { to { transform: scale(var(--sf)) rotate(calc(var(--sgnk)*1turn)) } }

.dir, .up { --k: 0 }
.rev, .dn { --k: 1 }

.end { --i: 0 }
.mid { --i: 1 }

.pos {	
	transform: 
		rotatey(var(--ay)) 
		translate3d(0, calc(var(--sgnk)*-.5*var(--h)), var(--z)) 
		rotatey(calc(-1*var(--ay)));
}

.s1d {
	--r: calc((3 + var(--i))*1px);
	animation: r 9s linear infinite reverse;
	
	&:after {
		$hue0: hue($lc);
		$sat0: saturation($lc);
		$lum0: lightness($lc);
		$hue1: hue($ec);
		$sat1: saturation($ec);
		$lum1: lightness($ec);
		
		position: absolute;
		margin: calc(-1*var(--r));
		padding: var(--r);
		border-radius: 50%;
		transform: rotatex(calc(-1*var(--ax)));
		box-shadow: 0 0 0 1px $bg;
		opacity: calc(-1*var(--sgnk)*(var(--fx) - var(--sgnk)*var(--lim))/(var(--max) - var(--lim)));
		background: 
			hsl(calc(var(--i)*#{$hue0} + var(--noti)*#{$hue1}), 
					calc(var(--i)*#{$sat0} + var(--noti)*#{$sat1}), 
					calc(var(--i)*#{$lum0} + var(--noti)*#{$lum1}));
		content: ''
	}
}

form {
	--pos: calc(.5*(#{$thumb-d} + (var(--fx) + var(--max))/var(--max)*(100% - #{$thumb-d})));
	padding: .5em;
	width: $track-w; height: 2*$input-h;
	background: rgba(#000, .5);
	font: 1em consolas, monaco, ubuntu mono, monospace
}

input, label {
	--hl: 0;
	--nothl: calc(1 - var(--hl))
}

input:focus, input:focus + label, 
[type='range']:hover, [type='checkbox'] + label:hover { --hl: 1 }

[type='range'] {
	&, &::-webkit-slider-thumb, 
	&::-webkit-slider-runnable-track {
		-webkit-appearance: none
	}
	
	display: block;
	width: 100%; height: $input-h;
	background: none;
	cursor: pointer;
	
	&::-webkit-slider-runnable-track {
		@include track
	}
	
	&::-moz-range-track {
		@include track
	}
	
	&::-webkit-slider-thumb {
		margin-top: .5*($track-h - $thumb-d);
		@include thumb
	}
	
	&::-moz-slider-thumb {
		@include thumb
	}
	
	+ label {
		display: block;
		text-align: center;
		
	}
	
	&:focus { outline: solid 0 transparent }
}

.token {
	&--num {
		counter-reset: fx var(--fx);
		
		&:after { content: counter(fx) }
	}
}

[type='checkbox'] {
	left: -100vmax;
	position: absolute;
	
	+ label {
		--check: 0;
		--notcheck: calc(1 - var(--check));
		overflow: hidden;
		position: absolute;
		top: $g; left: $g;
		border: solid $g transparent;
		width: $check-d; height: $check-d;
		border-radius: 5px;
		background: inherit;
		text-indent: -100vw;
		cursor: pointer;
		
		&:before, &:after {
			$hue0: hue($lc);
			$sat0: saturation($lc);
			$lum0: lightness($lc);
			$hue1: hue($dc);
			$sat1: saturation($dc);
			$lum1: lightness($dc);
			
			--q: 0;
			--notq: calc(1 - var(--q));
			position: absolute;
			top: 0; right: 0; bottom: 0; left: 0;
			transform-origin: 100% 50%;
			transform: scalex(calc(1 - var(--notcheck)*.2));
			background: 
			hsl(calc(var(--notcheck)*#{$hue0} + var(--check)*#{$hue1}), 
					calc(var(--notcheck)*#{$sat0} + var(--check)*#{$sat1}), 
					calc(var(--notcheck)*#{$lum0} + var(--check)*#{$lum1}));
			--points: calc(var(--q)*var(--check)*65%) 0, 
								calc(var(--q)*var(--check)*65%) 100%,  
								calc(100% - var(--notq)*var(--check)*65%) calc(100% - var(--notcheck)*50%), 
								calc(100% - var(--notq)*var(--check)*65%) calc(var(--notcheck)*50%);
			-webkit-clip-path: polygon(var(--points));
							clip-path: polygon(var(--points));
			filter: grayScale(var(--nothl));
			transition: .3s;
			content: ''
		}
		
		&:after { --q: 1 }
	}
	
	&:checked + label { --check: 1 }
}
            
          
!

JS

            
              function update(e) {
	let _t = e.target, 
			_scn = _t.parentNode.parentNode;
	
	if(_t.type === 'range') {
		let val = +_t.value;

		_scn.style.setProperty('--fx', val);
		return
	}
	
	if(_t.type === 'checkbox') {
		_scn.classList.toggle('playing')
	}
};

addEventListener('input', update, false);
            
          
!
999px

Console