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.

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

              
                .cube
	- 6.times do
		%div
              
            
!

CSS

              
                $p: 100px;
* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: rgba(0,0,0,0); }
body, html { height: 100%; }
body {
	background: $mint;
	display: flex;
	align-items: center;
	align-content: center;
	justify-content: center;
	perspective: 1000px;
	font-family: $body;
	color: $forest;
}

.cube {
	transform: rotateX(-30deg) rotateY(0) translateZ(0);
	transform-origin: $p/2 $p/2 #{-($p/2)};
	transform-style: preserve-3d;
	position: relative;
	width: $p;
	height: $p;
	animation: rotate 8000ms linear infinite;
	div {
		display: flex;
		align-items: center;
		align-content: center;
		justify-content: center;
		position: absolute;
		top: 0;
		left: 0;
		width: $p;
		height: $p;
		background: $forest;
		opacity: 0.75;
		// top
		&:nth-child(1) {
			background: lighten($grey, 15%);
			transform-origin: center top;
			transform: rotateX(90deg) translateY(#{-($p)});
			animation: top-init 4000ms ease-in-out 2, top 4000ms ease-in-out 8000ms infinite;
		}
		// bottom
		&:nth-child(2) {
			background: $beige;
			transform-origin: center bottom;
			transform: rotateX(-90deg) translateY($p);
			animation: bottom-init 4000ms ease-in-out 4, bottom 4000ms ease-in-out 8000ms infinite;
		}
		// left
		&:nth-child(3) {
			background: $green;
			transform-origin: left center;
			transform: rotateY(-90deg) translateX(#{-($p)});
			animation: left-init 4000ms ease-in-out 4, left 4000ms ease-in-out 8000ms infinite;
		}
		// right
		&:nth-child(4) {
			background: mix($green, $beige);
			transform-origin: right center;
			transform: rotateY(90deg) translateX($p);
			animation: right-init 4000ms ease-in-out 4, right 4000ms ease-in-out 8000ms infinite;
		}
		// front
		&:nth-child(5) {
			background: $pink;
			transform-origin: center center;
			transform: rotateX(0);
			animation: front-init 4000ms ease-in-out 4, front 4000ms ease-in-out 8000ms infinite;
		}
		// back
		&:nth-child(6) {
			background: mix($pink, $grey);
			transform-origin: center center;
			transform: rotateY(180deg) translateZ($p);
			animation: back-init 4000ms ease-in-out 4, back 4000ms ease-in-out 8000ms infinite;
		}
	}
}

@keyframes rotate {
	0% { transform: rotateX(0) rotateY(0) rotateZ(0) translateZ(0); }
	100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg) translateZ(0); }
}

@keyframes top {
	0% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ(0); }
	50% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ($p); }
	100% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ(0); }
}

@keyframes top-init {
	0% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ(0); }
	50% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ(#{$p/2}); }
	100% { transform: rotateX(90deg) translateY(#{-($p)}) translateZ(0); }
}

@keyframes bottom {
	0% { transform: rotateX(-90deg) translateY($p) translateZ(0); }
	50% { transform: rotateX(-90deg) translateY($p) translateZ($p); }
	100% { transform: rotateX(-90deg) translateY($p) translateZ(0); }
}

@keyframes bottom-init {
	0% { transform: rotateX(-90deg) translateY($p) translateZ(0); }
	50% { transform: rotateX(-90deg) translateY($p) translateZ(#{$p/2}); }
	100% { transform: rotateX(-90deg) translateY($p) translateZ(0); }
}

@keyframes left {
	0% { transform: rotateY(-90deg) translateX(#{-($p)}) scaleY(1); }
	50% { transform: rotateY(-90deg) translateX(#{-($p)}) scaleY(3); }
	100% { transform: rotateY(-90deg) translateX(#{-($p)}) scaleY(1); }
}

@keyframes left-init {
	0% { transform: rotateY(-90deg) translateX(#{-($p)}) translateZ(0); }
	50% { transform: rotateY(-90deg) translateX(#{-($p)}) translateZ(#{$p/2}); }
	100% { transform: rotateY(-90deg) translateX(#{-($p)}) translateZ(0); }
}

@keyframes right {
	0% { transform: rotateY(90deg) translateX($p) scaleY(1); }
	50% { transform: rotateY(90deg) translateX($p) scaleY(3); }
	100% { transform: rotateY(90deg) translateX($p) scaleY(1); }
}

@keyframes right-init {
	0% { transform: rotateY(90deg) translateX($p) translateZ(0); }
	50% { transform: rotateY(90deg) translateX($p) translateZ(#{$p/2}); }
	100% { transform: rotateY(90deg) translateX($p) translateZ(0); }
}

@keyframes front {
	0% { transform: rotateX(0) scaleY(1); }
	50% { transform: rotateX(0) scaleY(3); }
	100% { transform: rotateX(0) scaleY(1); }
}

@keyframes front-init {
	0% { transform: rotateX(0) translateZ(0); }
	50% { transform: rotateX(0) translateZ(#{$p/2}); }
	100% { transform: rotateX(0) translateZ(0); }
}

@keyframes back {
	0% { transform: rotateY(180deg) translateZ($p) scaleY(1); }
	50% { transform: rotateY(180deg) translateZ($p) scaleY(3); }
	100% { transform: rotateY(180deg) translateZ($p) scaleY(1); }
}

@keyframes back-init {
	0% { transform: rotateY(180deg) translateZ($p) translateZ(0); }
	50% { transform: rotateY(180deg) translateZ($p) translateZ(#{$p/2}); }
	100% { transform: rotateY(180deg) translateZ($p) translateZ(0); }
}
              
            
!

JS

              
                // ⟁ \\
              
            
!
999px

Console