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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              .assembly
	.switcher
		- 3.times do
			.part
				- 6.times do
					.face
            
          
!
            
              $base-edge: 2.75em;
$wide-edge: 3*$base-edge;
$base-bg: linear-gradient(
	#d9d9e4 33.333%, #26261a 0%, 
	#26261a 66.667%, #d9d9e4 0%);
$xtra-bg: linear-gradient(
	#26261a 33.333%, #d9d9e4 0%, 
	#d9d9e4 66.667%, #26261a 0%) 
	50% 50% no-repeat;
$t: .35s;

html { background: #262626; filter: sepia(1) }

.assembly {
	&, * {
		position: absolute;
		top: 50%; left: 50%;
		
		/* excludes IE up to & incl. 11 */
		transform-style: preserve-3d; 
	}
	
	transform: rotateX(-35.26deg) rotateY(45deg);
}

.switcher {
	animation: switch 6*$t steps(1, end) infinite;
}

@keyframes switch {
	33.333% { transform: rotateY(90deg); }
	66.667% { transform: rotate(90deg); }
}

.part {
	@for $i from 0 to 3 {
		&:nth-child(#{$i + 1}) {
			transform: translate(
				(1 - $i)*$base-edge);
			animation: split#{$i + 1} $t 
				cubic-bezier(0.77, 0, 0.175, 1) 
				infinite alternate;
			
			@if $i == 1 {
				@keyframes split#{$i + 1} {
					0%, 15% { transform: rotateX(0deg); }
					85%, 100% { transform: rotateX(90deg); }
				}
				animation-duration: 2*$t;
				animation-direction: reverse;
				
				.face {
					-webkit-filter: invert(100%);
					filter: invert(100%);
				}
			}
			@else {
				@at-root {
					@keyframes split#{$i + 1} {
						0%, 10% {
							transform: 
								/* fix Firefox flicker by multiplying with 1.01 */
								translate((1 - $i)*$base-edge*1.01);
						}
						90%, 100% {
							transform: 
								translate((1 - $i)*$base-edge*1.2);
						}
					}
				}
			}
		}
	}
}

.face {
	/* brackets needed or Sass computes
	   -$wide-edge/2 - $base-edge/2 */
	margin: -$wide-edge/2 (-$base-edge/2);
	width: $base-edge; height: $wide-edge;
	background: $base-bg;
	
	@for $i from 0 to 6 {
		&:nth-child(#{$i + 1}) {
			@if $i < 4 {
				transform: rotateX($i*90deg) 
					translateZ($wide-edge/2);
			}
			@else {
				margin: -$wide-edge/2;
				width: $wide-edge;
				transform: rotateY(pow(-1, $i)*90deg) 
					translateZ($base-edge/2);
				background: $xtra-bg, $base-bg;
				background-size: 33.333% 100%, 100% 100%;
			}
		}
	}
}
            
          
!
999px
Loading ..................

Console