Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <h2>Toilet-roll loader</h2>
<div class="wrapper">
	<div class="toiletroll">
		<div class="roll"></div>
		<div class="papers">
			<div class="paper">Loading</div>
			<div class="paper">Wait</div>
			<div class="paper">Please</div>
		</div>
	</div>
</div>
              
            
!

CSS

              
                $speed: 2s;

@import url(https://fonts.googleapis.com/css?family=Roboto:400);

html {
	height: 100%;
}
body {
	background: #444;
	text-align: center;
}
h2 {
		font: bold 35px 'Roboto';
		color: #ccc;
		text-shadow: 2px 2px 2px black;
}

.wrapper {
	display: inline-block;
	text-align: left;
	position: relative;
	width: 120px;
	height: 210px;
	margin: 15px 0 0 0;
}

.toiletroll {
	position: relative;
		width: 120px;
		height: 210px;
	.roll {
		position: absolute;
		width: 100px;
		height: 60px;
		background: #eee;
		border-radius: 15% 0% 0% 15% / 50% 0% 0% 50%;
		box-shadow: inset 0 0 1px rgba(0,0,0,.5),
								inset 0 5px 10px rgba(0,0,0,.3);
		background-image: linear-gradient(to bottom, #eeeeee 0%,#eeeeee 49%,#bbbbbb 50%,#eeeeee 51%,#eeeeee 100%); /* W3C */
		background-size: 100px 60px;
		animation: move-roll ($speed / 1.2) linear infinite;
		&:before {
			position: absolute;
      content: "";
			z-index: 1;
			height: 100%;
			width: 20%;
			right: -10%;
			border-radius: 50%;
			background-color: #eee;
			animation: anim-rollend ($speed / 10) linear infinite;
			background-image: radial-gradient(ellipse at center,
												#eeeeee 0%, #eeeeee 4%, #bbbbbb 5%, #eeeeee 6%, #eeeeee 9%,
												#bbbbbb 10%, #eeeeee 11%, #eeeeee 14%, #bbbbbb 15%, #eeeeee 16%, #eeeeee 19%,
												#bbbbbb 20%, #eeeeee 21%, #eeeeee 24%, #bbbbbb 25%, #eeeeee 26%, #eeeeee 29%,
												#bbbbbb 30%, #eeeeee 31%, #eeeeee 34%, #bbbbbb 35%, #eeeeee 36%, #eeeeee 39%,
												#bbbbbb 40%, #eeeeee 41%, #eeeeee 44%, #bbbbbb 45%, #eeeeee 46%, #eeeeee 49%,
												#bbbbbb 50%, #eeeeee 51%, #eeeeee 54%, #bbbbbb 55%, #eeeeee 56%, #eeeeee 59%,
												#bbbbbb 60%, #eeeeee 61%, #eeeeee 64%, #bbbbbb 65%, #eeeeee 66%, #eeeeee 69%,
												#bbbbbb 70%, #eeeeee 71%, #eeeeee 74%, #bbbbbb 75%, #eeeeee 76%, #eeeeee 79%,
												#bbbbbb 80%, #eeeeee 81%, #eeeeee 84%, #bbbbbb 85%, #eeeeee 86%, #eeeeee 89%,
												#bbbbbb 90%, #eeeeee 91%, #eeeeee 94%, #bbbbbb 95%, #eeeeee 96%, #eeeeee 100%);
			background-repeat: no-repeat;
			box-shadow: inset 0 0 1px rgba(0,0,0,.5);
		}
		&:after {
			position: absolute;
      content: "";
			z-index: 1;
			height: 40%;
			width: 8%;
			top: 30%;
			right: -4%;
			border-radius: 50%;
			background: black;
			box-shadow: inset 0 0 1px rgba(0,0,0,.5);
		}
	}
	.papers {
		position: relative;
		z-index: -1;
		width: 100px;
		height: 180px;
		top: 30px;
		left: 10px;
		overflow: hidden;
		&:after {
			position: absolute;
      content: "";
			width: 100%;
			height: 33%;
			box-shadow: inset 0 30px 10px rgba(0,0,0,.2);
		}
		.paper {
			position: absolute;
			width: 100px;
			height: 60px;
			background-color: #eee;
			box-shadow: inset 0 0 1px rgba(0,0,0,.5);
			text-align: center;
			font: bold 15px/60px 'Roboto';
			color: #bbb;
			text-shadow: -1px -1px 1px rgba(255,255,255,.4),
										1px 1px 1px rgba(0,0,0,.4);
			animation: move-paper $speed linear infinite;
			&:nth-of-type(1) {
			}
			&:nth-of-type(2) {
				animation-delay: (-$speed / 3 ) * 1;
			}
			&:nth-of-type(3) {
				animation-delay: (-$speed / 3 ) * 2;
			}
		}
	}
}

@keyframes move-paper {
	0% {
		opacity: 1;
		transform: translateY(-60px);
	}
	50% {
		transform: translateY(20px);
	}
	75% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translateY(120px);
	}
}
@keyframes move-roll {
	  0% {background-position: 0px 120px;}
	100% {background-position: 0px 0px;}
}

@keyframes anim-rollend {
	0% {background-size: 100% 100%;background-position: 0 0;}
 50% {background-size: 98% 98%;background-position: 1px 1px;}
}

              
            
!

JS

              
                /*
Toilet-roll loader
*/
              
            
!
999px

Console