123

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <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>
            
          
!
            
              $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;}
}

            
          
!
            
              /*
Toilet-roll loader
*/
            
          
!
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.

Console