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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <input type="checkbox" id="start">
<label for="start" id="start_label">
</label>
<div class="frame"></div>
<h2 id="SCSS">
	<span>I</span><span> </span><span>l</span><span>o</span><span>v</span><span>e</span><span> </span><span>S</span><span>C</span><span>S</span><span>S</span>
</h2>
<h2 id="mixin">Mixin is winnin!</h2>
<h2 id="anim">
	<span class="line">Animation</span><span class="line">is</span><span class="line">creation!</span>
</h2>
<div class="perspective_wrap">
	<div class="carousel">
		<div class="side"><h2>The Carousel</h2><p class="arrow">-></p></div>
		<div class="side"><h2>Side 2</h2><p class="arrow">-></p></div>
		<div class="side"><h2>Side 3</h2><p class="arrow">-></p></div>
		<div class="side"><h2>Side 4</h2><p class="arrow">-></p></div>
		<div class="side"><h2>Side 5</h2><p class="arrow">-></p></div>
		<div class="side"><h2>Side 6</h2><p class="arrow">-></p></div>
	</div>
</div>
              
            
!

CSS

              
                $anim-delay: 0;
@mixin keyframes($animation-name) {
	@-webkit-keyframes #{$animation-name} {
		@content;
	}
	@-moz-keyframes #{$animation-name} {
		@content;
	}
	@-ms-keyframes #{$animation-name} {
		@content;
	}
	@-o-keyframes #{$animation-name} {
		@content;
	}
	@keyframes #{$animation-name} {
		@content;
	}
}

// Function which will add the delay if said so
@function queue($delay) {
	$anim-delay: $anim-delay + $delay !global;
	@return $anim-delay - $delay;
}

// Example: @include animation('name 2s forward', 2) | Leave second argument empty if out of delay-order
@mixin animation($str) {
	-webkit-animation: #{$str};
	-moz-animation: #{$str};
	-ms-animation: #{$str};
	-o-animation: #{$str};
	animation: #{$str};
}

@mixin transition($args...) {
	-webkit-transition: $args;
	-moz-transition: $args;
	-ms-transition: $args;
	-o-transition: $args;
	transition: $args;
}

@mixin scale($args...) {
	-ms-transform: scale($args);
	-webkit-transform: scale($args);
	transform: scale($args);
}

@mixin on($arg) {
	#start:checked ~ #{$arg} {
		@content;
	}
}

@mixin off($arg) {
	#start:not(: checked) ~ #{$arg} {
		@content;
	}
}

* {
	margin: 0;
	padding: 0;
}

body,
html {
	width: 100%;
	height: 100%;
	overflow: hidden;
}

body {
	box-sizing: border-box;
	font: 20px 'Roboto', sans-serif;
	background: linear-gradient(rgb(0, 102, 102), rgb(60, 102, 102), rgb(77, 0, 38));
}

input[type="checkbox"] {
	position: absolute;
	left: -1000px;
	margin-left: -1000px;
}

#start_label,
.frame {
	width: 5em;
	height: 5em;
	position: absolute;
	top: calc(50% - 2.5em);
	left: calc(50% - 2.5em);
	border-radius: 1em;
	box-sizing: border-box;
}

#start:not(:checked) ~ label,
#start:not(:checked) ~ .frame {
	@include animation('rotate_border 2s forwards infinite ease-in-out');
}

$frame-anim: '';


@include keyframes('rotate_border') {
	50% {
		top: calc(50% - 3em);
		left: calc(50% - 3em);
		width: 6em;
		height: 6em;
	}
	100% {
		transform: rotateZ(0.5turn);
	}
}

#start_label {
	cursor: pointer;
	z-index: 1;
	opacity: 0;
}

@include on(label) {
	height: 2em;
	top: calc(100% - 2em);
	left: calc(100% - 5em);
	border-radius: 0;
	border-top-left-radius: 1em;
	background-color: rgba(244, 244, 244, 0.4);
	opacity: 1;
	padding: 0.4em;
	&:before {
		content: "Restart";
		font-weight: bold;
	}
	@include transition(opacity 0.4s ease-in-out);
}

.frame {
	@include transition(all 1s);
	border: 1em solid rgba(255, 255, 204, 0.4);
	background: rgba(255, 255, 255, 0.1);
}

// Frame-animation
$frame-anim: 'frame #{2}s forwards #{queue(2)+"s"}';
@include keyframes('frame') {
	40%,
	70%,
	100% {
		height: 10em;
		width: 10em;
		top: calc(50% - 5em);
		left: calc(50% - 5em);
	}
	70%,
	100% {
		width: 100%;
		left: 0;
	}
	100% {
		height: 100%;
		top: 0;
		border-radius: 0;
	}
}

#SCSS {
	text-align: center;
	padding: 10rem 2rem;
	font-size: 0;
	span {
		opacity: 0;
		@include transition(opacity 0.4s 0s);
	}
}

$SCSS_letters: 13;
@include on(#SCSS span) {
	opacity: 1;
	@for $i from 1 to $SCSS_letters {
		&:nth-child(#{$i}) {
			@include transition(opacity 2s #{queue(0.1)+"s"});
		}
	}
	$nothing: queue(1);
	@for $i from 1 to $SCSS_letters {
		&:nth-child(#{$i}) {
			@include animation('zero_height 0.2s forwards ease-in #{queue(0.05)+'s'}');
		}
	}
}

@include on(#SCSS) {
	font-size: 10vw;
}

@include keyframes('zero_height') {
	100% {
		font-size: 0;
		height: 0;
	}
}

// Close Frame (Add delay)
$frame-anim: $frame-anim + ',frame 2s forwards reverse #{queue(2)+"s"}';
// BoxShadow
$frame-anim: $frame-anim + ',frame_shadow 1s forwards #{queue(1)+"s"}';
@include keyframes('frame_shadow') {
	100% {
		box-shadow: 0 0 0 2000px black;
		transform: rotateZ(0.5turn);
	}
}

// Grow frame
$frame-anim: $frame-anim + ',grow_frame 2s forwards #{queue(2)+"s"}';
@include keyframes('grow_frame') {
	100% {
		left: calc(50% - 20vw);
		top: calc(50% - 5em);
		width: 40vw;
		height: 10em;
	}
}

// So what is this about?
#mixin {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	text-align: center;
	transform: translate(-50%, -50%);
	font-size: 0;
	letter-spacing: 0.1em;
}

@include on(#mixin) {
	$sychron: queue(-1);
	@include transition(all 1s #{queue(1)+'s'});
	font-size: 1.4em;
	$pause: queue(1);
	@include animation('blow_text 0.4s forwards #{queue(0.4)+'s'}');
}

@include keyframes('blow_text') {
	100% {
		font-size: 2em;
		line-height: 5em;
		letter-spacing: 3em;
		opacity: 0;
	}
}

// Shrink frame
$frame-anim: $frame-anim + ',grow_frame 1s forwards reverse #{queue(1)+"s"}';
// Remove boxShadow
$frame-anim: $frame-anim + ',frame_shadow 1s forwards reverse #{queue(1)+"s"}';
// Make underline out of frame
$frame-anim: $frame-anim + ',frame_underline 1s forwards #{queue(1)+"s"} ease-in-out';
@include keyframes('frame_underline') {
	100% {
		left: calc(50% - 20vw);
		top: calc(70%);
		width: 40vw;
		height: 0.4em;
		border-radius: 0 0 0.5em 0.5em;
		border-width: 0.4em;
	}
}

// Animation is creation
$anim-lines: 3;
#anim {
	position: absolute;
	left: 50%;
	bottom: 30%;
	transform: translate(-50%, 0);
	.line {
		font-size: 0;
		text-align: center;
		display: block;
		@include transition(opacity 0.6s, font-size 0.6s);
	}
}

@include on("#anim") {
	.line {
		@for $i from 1 to $anim-lines+1 {
			&:nth-of-type(#{$i}) {
				@include transition(font-size 0.4s #{(queue(0.8))+"s"});
			}
		}
		opacity: 1;
		font-size: 2em;
	}
}

$anim_text-anim: 'center 2s ease-in-out forwards #{queue(0)+"s"}';
@include keyframes('center') {
	100% {
		left: 50%;
		bottom: 50%;
		transform: translate(-50%, 50%);
	}
}

// underline to frame
$frame-anim: $frame-anim + ',frame_underline 1s forwards reverse #{queue(1)+"s"}';
// Center frame
$frame-anim: $frame-anim + ',frame-center 1s forwards #{queue(1)+"s"}';
@include keyframes('frame-center') {
	100% {
		top: calc(50% - 9em);
		left: calc(50% - 9em);
		width: 18em;
		height: 18em;
		border-radius: 1em;
		border-width: 1em;
	}
}


// Cube
$sides: 6;
$angle: 360/$sides;
$side-width: 16em;
$side-height: 20em;
.perspective_wrap {
	position: absolute;
	top: -100%;
	width: 100%;
	height: 100%;
	perspective: $side-width*5;
	perspective-origin: 50% $side-height;
	transition: top 1s #{queue(1)+'s'} ease-in-out;
}

.carousel {
	position: absolute;
	top: calc(50% - #{$side-height/2});
	left: calc(50% - #{$side-width/2});
	width: $side-width;
	height: $side-height;
	transform-style: preserve-3d;
	.side {
		text-align: center;
		position: absolute;
		width: 100%;
		height: 100%;
		background: rgb(102, 0, 51);
		background: linear-gradient(rgb(102, 0, 51), rgb(0, 26, 51));
		border: 0.1em solid rgb(100, 100, 100);
		padding: 1em;
		box-sizing: border-box;
	}
	@for $i from 1 to 7 {
		.side:nth-child(#{$i}) {
			transform: rotateY(#{($i - 1)*$angle+'deg'}) translate3d(0, 0, #{($side-width/2)/tan($angle/360*pi())});
			p.arrow {
				@include animation('blink 2s infinite ease #{queue(0)+$i*0.5+"s"}');
			}
		}
	}
	h2 {
		font-size: 1.6em;
	}
	p.arrow {
		font-weight: bold;
		font-size: 6em;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		opacity: 0;
	}
}

@include on('.perspective_wrap') {
	top: 0;
}

@include on('* .carousel') {
	@include animation('rotate_carousel #{$sides*2+2+"s"} forwards #{queue($sides*2+2)+"s"}, turn_carousel 2s #{queue(2)+"s"} forwards, spin_carousel 10s #{queue(10)+"s"} forwards ease-in, fade 3s forwards #{queue(0)-3+"s"}');
}

@include keyframes('rotate_carousel') {
	@for $i from 0 to ($sides) {
		#{100*$i/($sides - 1)+"%"} {
			transform: rotateY(#{- $angle*$i+"deg"});
		}
	}
}

@include keyframes('turn_carousel') {
	0% {
		transform: rotateY(#{- $angle*($sides - 1)+"deg"});
	}
	100% {
		transform: rotateY(0deg) rotateX(90deg);
	}
}

@include keyframes('spin_carousel') {
	0% {
		transform: rotateX(90deg) rotateY(0deg);
	}
	100% {
		transform: rotateX(90deg) rotateY(#{10*360+"deg"});
		width: 0;
		height: 0;
		top: 50%;
		left: 50%;
		color: rgba(0,0,0,0);
	}
}

@include keyframes('blink') {
	50% {
		opacity: 1;
	}
}
@include keyframes('fade') {
	100% {
		opacity: 0;
	}
}
$nothing: #{queue(-5)};

// Fadeout 
$anim_text-anim: $anim_text-anim + ' ,fade 1s forwards #{queue(1)+"s"}';


// Add remaining animations
@include on('#anim') {
	@include animation($anim_text-anim);
}
@include on('.frame') {
	@include animation($frame-anim);
}
              
            
!

JS

              
                // Click the Square to start the animation :)


              
            
!
999px

Console