cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              - var nc = 13, nr = 13, n = nc*nr;
- var d = 400, o = -.5*d;
- var e0x = .2*d, e0y = .1*d;

style
	- for(var i = 1; i < nr; i++) {
		| .cube:nth-child(n + #{i*nc + 1}) { --j: #{i} }
	-}
	- for(var i = 1; i < nc; i++) {
		| .cube:nth-child(#{nc}n + #{i + 1}) { --i: #{i} }
	-}
.a3d
	while n--
		.cube
			- var n6hedron = 6;
			while n6hedron--
				.cube__face
	svg(viewBox=[o, o, d, d].join(' ') stroke-width=.035*d)
		path(d=`M${-e0x} ${e0y}Q0 ${.75*d} ${e0x} ${e0y}
						M0 ${.35*d}Q0${.65*o} ${-o}${.8*o}`)
            
          
!
            
              @import 'compass/css3';

$l: 5em;
$n6hedron: 6;
$n4gon: 4;
$ba4gon: 360deg/$n4gon;

body {
	margin: 0;
	height: 100vh;
	perspective: 20em
}

div, :before, :after, svg {
	--i: 0;
	--j: 0;
	position: absolute;
	transform-style: preserve-3d
}

.a3d {
	top: 50%; left: 50%;
	color: #b53;
	
	&:before {
		z-index: 2;
		margin: -4px;
		padding: 4px;
		border-radius: 50%;
		background: currentcolor;
		content: ''
	}
	
	&:after {
		bottom: .5*$l; left: .5*$l;
		width: calc(50vw - #{$l});
		font: 1.375em comic sans ms, sans-serif;
		content: "middle of screen = middle of top left cube's vertical section"
	}
}

svg {
	left: calc(50% - #{.5*$l}); bottom: 0;
	width: $l; height: $l;
}

path {
	fill: none;
	stroke: currentcolor;
}

.cube {
	--x: calc(var(--i)*#{$l});
	--y: calc(var(--j)*#{$l});
	transform: translate(var(--x), var(--y));
	color: #222;
	
	&:first-child:before {
		margin: -.5*$l;
		width: $l; height: $l;
		box-shadow: inset 0 0 1px 1px currentcolor;
		opacity: .7;
		background: repeating-linear-gradient(-65deg, 
			currentcolor 0, currentcolor 2px, 
			transparent 0, transparent 7px);
		color: #f90;
		content: ''
	}
	
	&__face {
		--j: calc(1 - var(--i));
		margin: -.5*$l;
		width: $l; height: $l;
		transform: rotate3d(var(--i), var(--j), 0, calc(var(--m, 1)*#{$ba4gon})) 
			translatez(.5*$l);
		box-shadow: inset 0 0 1px 1px currentcolor;
		
		&:nth-child(n + #{$n4gon + 1}) { --i: 1 }
		
		@for $i from 0 to 6 {
			@if $i%($n4gon - 1) != 1 {
				&:nth-child(#{$i + 1}) { --m: if($i < $n4gon, $i, -1) }
			}
		}
	}
}
            
          
!
999px
Loading ..................

Console