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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              .cube
	- 6.times do
		%div
            
          
!
            
              $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); }
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console