From 1 to 1 million in CSS and 3d

In this example below you will see how to do a From 1 to 1 million in CSS and 3d with some HTML / CSS and Javascript

Experiment with CSS3 animation to create an old fashion car odometer.Webkit is a little buggy with this and I haven't supported IE.

Thumbnail
This awesome code was written by paulobrien, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright paulobrien ©
  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>From 1 to 1 million in CSS and 3d</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <h1>Clock this car's odometer - (best viewed in Firefox)</h1>
<h2> From 1 - 1 million in 10 seconds with css only</h2>
<p>Hover box below to pause counter (webkit is very buggy with the pause)</p>
<div class="container">
		<div class="stage">
				<ol class="wheel units">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel tens">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hundreds">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel ten-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hun-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel  millions">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
		</div>
</div>
<div class="info">
		<p>Only Firefox animates the units and tens columns as the durations is set too fast</p>
		<p>As it's still to quick for webkit lets slow it down again</p>
		<h2>From 1 - 1 million in 1000 seconds with css only</h2>
</div>
<div class="container wrap2">
		<div class="stage">
				<ol class="wheel units">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel tens">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hundreds">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel ten-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hun-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel  millions">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
		</div>
</div>


<div class="info">
		<p>Let's do it in real time</p>
		<h2>From 1 - 1 million in 1000000 seconds with css only</h2>
</div>

<div class="container wrap3">
		<div class="stage">
				<ol class="wheel units">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel tens">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hundreds">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel ten-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel hun-thousands">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
				<ol class="wheel  millions">
						<li class="one">0</li>
						<li class="two">1</li>
						<li class="three">2</li>
						<li class="four">3</li>
						<li class="five">4</li>
						<li class="six">5</li>
						<li class="seven">6</li>
						<li class="eight">7</li>
						<li class="nine">8</li>
						<li class="ten">9</li>
				</ol>
		</div>
</div>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/paulobrien/from-1-to-1-million-in-css-and-3d-Gycsa */
/* css for the spinning panels adapted from here: 
 http://www.webkit.org/blog-files/3d-transforms/morphing-cubes.html
*/
ol {
	margin:0;
	padding:0;
	list-style:none
}
.info { clear:both }
body {
	background-color: black;
	color: white;
	font-family: 'Lucida Grande', Verdana, Arial;
	font-size: 12px;
}
.container {
	-webkit-perspective: 800; /* For compatibility with iPhone 3.0, we leave off the units here */
	-webkit-perspective-origin: 50% 225px;
	-moz-perspective: 800px;
	-moz-perspective-origin: 50% 225px;
	perspective: 800px;
	perspective-origin: 50% 225px;
	float:left;
	margin:0 0 120px 50px;
	clear:both;
	padding:110px 0 0;
	position: relative;
}
.stage {
	-webkit-transition: -webkit-transform 2s;
	-webkit-transform-style: preserve-3d;
	-moz-transition: -webkit-transform 2s;
	-moz-transform-style: preserve-3d;
	transition: -webkit-transform 2s;
	transform-style: preserve-3d;
	float:left;
}
.wheel {
	position: relative;
	margin: 0 auto;
	height: 50px;
	width: 50px;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	transform-style: preserve-3d;
	float:right;
	margin:0 0 0 10px;
}
.wheel li {
	position: absolute;
	height: 56px;
	width: 56px;
	line-height:56px;
	-webkit-border-radius: 12px;
	-webkit-box-sizing: border-box;
	-moz-border-radius: 12px;
	-moz-box-sizing: border-box;
	border-radius: 12px;
	box-sizing: border-box;
	text-align: center;
	font-family: Times, serif;
	font-size: 24pt;
	color: black;
	background-color: rgba(255, 255, 255, 0.6);
	-webkit-transition: -webkit-transform 2s, opacity 2s;
	-webkit-backface-visibility: hidden;
	-moz-transition: -webkit-transform 2s, opacity 2s;
	-moz-backface-visibility: hidden;
	transition: -webkit-transform 2s, opacity 2s;
	backface-visibility: hidden;
}
@-webkit-keyframes spin1 { 
	from {-webkit-transform: rotateX(0);}
	to { -webkit-transform: rotateX(360deg); }
}
@-moz-keyframes spin1 { 
	from {-moz-transform: rotateX(0);}
	to { -moz-transform: rotateX(360deg); }
}
@keyframes spin1 { 
	from {transform: rotateX(0);}
	to { transform: rotateX(360deg); }
}
@-webkit-keyframes spin {  
	0% {-webkit-transform: rotateX(0deg);}
 9% {-webkit-transform: rotateX(0deg);}
 10% {-webkit-transform: rotateX(35.5deg);}
 19% {-webkit-transform: rotateX(35.5deg);}
 20% {-webkit-transform: rotateX(70.5deg);}
 29% {-webkit-transform: rotateX(70.5deg);}
 30% {-webkit-transform: rotateX(105deg);}
 39% {-webkit-transform: rotateX(105deg);}
 40% {-webkit-transform: rotateX(140deg);}
 49% {-webkit-transform: rotateX(140deg);}
 50% {-webkit-transform: rotateX(176.5deg);}
 59% {-webkit-transform: rotateX(176.5deg);}
 60% {-webkit-transform: rotateX(212.5deg);}
 69% {-webkit-transform: rotateX(212.5deg);}
 70% {-webkit-transform: rotateX(249.5deg);}
 79% {-webkit-transform: rotateX(249.5deg);}
 80% {-webkit-transform: rotateX(287deg);}
 89% {-webkit-transform: rotateX(287deg);}
 90% {-webkit-transform: rotateX(323.5deg);}
 99% {-webkit-transform: rotateX(323.5deg);}
 100% {-webkit-transform: rotateX(360deg);}
}
@-moz-keyframes spin {  
	0% {-moz-transform: rotateX(0deg);}
 9% {-moz-transform: rotateX(0deg);}
 10% {-moz-transform: rotateX(35.5deg);}
 19% {-moz-transform: rotateX(35.5deg);}
 20% {-moz-transform: rotateX(70.5deg);}
 29% {-moz-transform: rotateX(70.5deg);}
 30% {-moz-transform: rotateX(105deg);}
 39% {-moz-transform: rotateX(105deg);}
 40% {-moz-transform: rotateX(140deg);}
 49% {-moz-transform: rotateX(140deg);}
 50% {-moz-transform: rotateX(176.5deg);}
 59% {-moz-transform: rotateX(176.5deg);}
 60% {-moz-transform: rotateX(212.5deg);}
 69% {-moz-transform: rotateX(212.5deg);}
 70% {-moz-transform: rotateX(249.5deg);}
 79% {-moz-transform: rotateX(249.5deg);}
 80% {-moz-transform: rotateX(287deg);}
 89% {-moz-transform: rotateX(287deg);}
 90% {-moz-transform: rotateX(323.5deg);}
 99% {-moz-transform: rotateX(323.5deg);}
 100% {-moz-transform: rotateX(360deg);}
}

@keyframes spin {  
	0% {transform: rotateX(0deg);}
 9% {transform: rotateX(0deg);}
 10% {transform: rotateX(35.5deg);}
 19% {transform: rotateX(35.5deg);}
 20% {transform: rotateX(70.5deg);}
 29% {transform: rotateX(70.5deg);}
 30% {transform: rotateX(105deg);}
 39% {transform: rotateX(105deg);}
 40% {transform: rotateX(140deg);}
 49% {transform: rotateX(140deg);}
 50% {transform: rotateX(176.5deg);}
 59% {transform: rotateX(176.5deg);}
 60% {transform: rotateX(212.5deg);}
 69% {transform: rotateX(212.5deg);}
 70% {transform: rotateX(249.5deg);}
 79% {transform: rotateX(249.5deg);}
 80% {transform: rotateX(287deg);}
 89% {transform: rotateX(287deg);}
 90% {transform: rotateX(323.5deg);}
 99% {transform: rotateX(323.5deg);}
 100% {transform: rotateX(360deg);}
}
@-webkit-keyframes spin3 { 
	0% {-webkit-transform: rotateX(0deg);}
 90% {-webkit-transform: rotateX(0deg);}
 100% {-webkit-transform: rotateX(35.5deg);}
}
@-moz-keyframes spin3 { 
		0% {-moz-transform: rotateX(0deg);}
 90% {-moz-transform: rotateX(0deg);}
 100% {-moz-transform: rotateX(35.5deg);}
}
@keyframes spin3 { 
	0% {transform: rotateX(0deg);}
 90% {transform: rotateX(0deg);}
 100% {transform: rotateX(35.5deg);}
}

/* ---------- wheel styles ------------- */
.wheel .one { -webkit-transform: translateZ(90px); }
.wheel .two { -webkit-transform: rotateX(-36deg) translateZ(90px); }
.wheel .three { -webkit-transform: rotateX(-72deg) translateZ(90px); }
.wheel .four { -webkit-transform: rotateX(-108deg) translateZ(90px); }
.wheel .five { -webkit-transform: rotateX(-144deg) translateZ(90px); }
.wheel .six { -webkit-transform: rotateX(-180deg) translateZ(90px); }
.wheel .seven { -webkit-transform: rotateX(-216deg) translateZ(90px); }
.wheel .eight { -webkit-transform: rotateX(-252deg) translateZ(90px); }
.wheel .nine { -webkit-transform: rotateX(-288deg) translateZ(90px); }
.wheel .ten { -webkit-transform: rotateX(-324deg) translateZ(90px); }
/* mozilla */
/* ---------- wheel styles ------------- */
.wheel .one { -moz-transform: translateZ(90px); }
.wheel .two { -moz-transform: rotateX(-36deg) translateZ(90px); }
.wheel .three { -moz-transform: rotateX(-72deg) translateZ(90px); }
.wheel .four { -moz-transform: rotateX(-108deg) translateZ(90px); }
.wheel .five { -moz-transform: rotateX(-144deg) translateZ(90px); }
.wheel .six { -moz-transform: rotateX(-180deg) translateZ(90px); }
.wheel .seven { -moz-transform: rotateX(-216deg) translateZ(90px); }
.wheel .eight { -moz-transform: rotateX(-252deg) translateZ(90px); }
.wheel .nine { -moz-transform: rotateX(-288deg) translateZ(90px); }
.wheel .ten { -moz-transform: rotateX(-324deg) translateZ(90px); }
/* standard */
/* ---------- wheel styles ------------- */
.wheel .one { transform: translateZ(90px); }
.wheel .two { transform: rotateX(-36deg) translateZ(90px); }
.wheel .three { transform: rotateX(-72deg) translateZ(90px); }
.wheel .four { transform: rotateX(-108deg) translateZ(90px); }
.wheel .five { transform: rotateX(-144deg) translateZ(90px); }
.wheel .six { transform: rotateX(-180deg) translateZ(90px); }
.wheel .seven { transform: rotateX(-216deg) translateZ(90px); }
.wheel .eight { transform: rotateX(-252deg) translateZ(90px); }
.wheel .nine { transform: rotateX(-288deg) translateZ(90px); }
.wheel .ten { transform: rotateX(-324deg) translateZ(90px); }
/* set timing for each wheel */
.units {
	-webkit-animation:spin1 .0001s linear 100000;
	-moz-animation: spin1 .0001s linear 100000;
	animation: spin1 .0001s linear 100000;
}
.tens {
	-webkit-animation:spin .001s linear 0s 10000;
	-moz-animation: spin .001s linear 0s 10000;
	animation: spin .001s linear 0s 10000;
}
.hundreds {
	-webkit-animation:spin .01s linear 0s 1000;
	-moz-animation:spin .01s linear 0s 1000;
	animation:spin .01s linear 0s 1000;
}
.thousands {
	-webkit-animation:spin .1s linear 0s 100;
	-moz-animation:spin .1s linear 0s 100;
	animation:spin .1s linear 0s 100;
}
.ten-thousands {
	-webkit-animation:spin 1s linear 0s 10;
	-moz-animation:spin 1s linear 0s 10;
	animation:spin 1s linear 0s 10;
}
.hun-thousands {
	-webkit-animation:spin 10s linear 0s 1;
	-moz-animation:spin 10s linear 0s 1;
	animation:spin 10s linear 0s 1;
}
.millions {
	-webkit-animation:spin3 10s linear 0s 1 forwards;
	-moz-animation:spin3 10s linear 0s 1 forwards;
	animation:spin3 10s linear 0s 1 forwards;
}
/* slower version */
.wrap2 .units {
	-webkit-animation:spin .01s linear 100000;
	-moz-animation: spin .01s linear 100000;
	animation: spin .01s linear 100000;
}
.wrap2 .tens {
	-webkit-animation:spin .1s linear 0s 10000;
	-moz-animation: spin .1s linear 0s 10000;
	animation: spin .1s linear 0s 10000;
}
.wrap2 .hundreds {
	-webkit-animation:spin 1s linear 0s 1000;
	-moz-animation:spin 1s linear 0s 1000;
	animation:spin 1s linear 0s 1000;
}
.wrap2 .thousands {
	-webkit-animation:spin 10s linear 0s 100;
	-moz-animation:spin 10s linear 0s 100;
	animation:spin 10s linear 0s 100;
}
.wrap2 .ten-thousands {
	-webkit-animation:spin 100s linear 0s 10;
	-moz-animation:spin 100s linear 0s 10;
	animation:spin 100s linear 0s 10;
}
.wrap2 .hun-thousands {
	-webkit-animation:spin 1000s linear 0s 1;
	-moz-animation:spin 1000s linear 0s 1;
	animation:spin 1000s linear 0s 1;
}
.wrap2 .millions {
	-webkit-animation:spin3 1000s linear 0s 1 forwards;
	-moz-animation:spin3 1000s linear 0s 1 forwards;
	animation:spin3 1000s linear 0s 1 forwards;
}
/* Even slower version */
.wrap3 .units {
	-webkit-animation:spin 10s linear 100000;
	-moz-animation: spin 10s linear 100000;
	animation: spin 10s linear 100000;
}
.wrap3 .tens {
	-webkit-animation:spin 100s linear 0s 10000;
	-moz-animation: spin 100s linear 0s 10000;
	animation: spin 100s linear 0s 10000;
}
.wrap3 .hundreds {
	-webkit-animation:spin 1000s linear 0s 1000;
	-moz-animation:spin 1000s linear 0s 1000;
	animation:spin 1000s linear 0s 1000;
}
.wrap3 .thousands {
	-webkit-animation:spin 10000s linear 0s 100;
	-moz-animation:spin 10000s linear 0s 100;
	animation:spin 10000s linear 0s 100;
}
.wrap3 .ten-thousands {
	-webkit-animation:spin 100000s linear 0s 10;
	-moz-animation:spin 100000s linear 0s 10;
	animation:spin 100000s linear 0s 10;
}
.wrap3 .hun-thousands {
	-webkit-animation:spin 1000000s linear 0s 1;
	-moz-animation:spin 1000000s linear 0s 1;
	animation:spin 1000000s linear 0s 1;
}
.wrap3 .millions {
	-webkit-animation:spin3 1000000s linear 0s 1 forwards;
	-moz-animation:spin3 1000000s linear 0s 1 forwards;
	animation:spin3 1000000s linear 0s 1 forwards;
}


/* pause animation*/
.container:hover * {
	-webkit-animation-play-state:paused;
	-moz-animation-play-state:paused;
	animation-play-state:paused;
}
.container:after {
	content:"";
	position:absolute;
	bottom: -75px;
	left: -41px;
	right: -59px;
	top: 30px;
	z-index:999;
	border:20px solid rgba(150,10,10,0.8);
	border-top:63px solid rgba(150,10,10,0.8);
	border-bottom:74px solid rgba(150,10,10,0.8);
	pointer-events:none;
	border-radius:12px;
}


/*Downloaded from https://www.codeseek.co/paulobrien/from-1-to-1-million-in-css-and-3d-Gycsa */
//nope

Comments