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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <div class="visual-clocks">
		<div class="visual-clocks--wrapper">

			<div class="visual-clocks--signs">
				<div class="visual-clocks--numbers"></div>
				<div class="visual-clocks--dots"></div>
			</div>

			<div class="visual-clocks--arrows">
				<div class="visual-clocks--arrow-item visual-clocks--pinner"></div>
				<div class="visual-clocks--arrow-item visual-clocks--hour-arrow"></div>
				<div class="visual-clocks--arrow-item visual-clocks--minute-arrow"></div>
				<div class="visual-clocks--arrow-item visual-clocks--second-arrow"></div>
			</div>

		</div>
	</div> <!-- /.visual-clocks-container -->

<script
  src="https://code.jquery.com/jquery-3.2.1.min.js"
  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  crossorigin="anonymous"></script>

              
            
!

CSS

              
                body { margin: 0; }

.visual-clocks {
	-webkit-user-select: none;
	user-select: none;

	position: relative;
	z-index: 1;
	width: 400px;
	height: 400px;
	margin: 50px auto;
	padding: 20px;
	overflow: hidden;

	-webkit-box-shadow: 0px 0px 20px 0px rgba(0,0,0, .1);
	box-shadow: 0px 0px 20px 0px rgba(0,0,0, .1);

	background-color: #fff;

	border-radius: 50%;
}
.visual-clocks:after {
	position: absolute;
	content: "";
	top: 12%;
	left: 12%;
	right: 12%;
	bottom: 12%;
	-webkit-box-shadow: 0px 0px 20px 0px rgba(0,0,0, .1);
	box-shadow: 0px 0px 20px 0px rgba(0,0,0, .1);

	z-index: -1;
	border-radius: 50%;

}

.visual-clocks--wrapper {
	width: 100%;
	height: 100%;
	position: relative;

	-webkit-transform: rotate(-90deg);
	-ms-transform: rotate(-90deg);
	-o-transform: rotate(-90deg);
	transform: rotate(-90deg);
}

.visual-clocks--signs {
	-webkit-transform: rotate(90deg);
	-ms-transform: rotate(90deg);
	-o-transform: rotate(90deg);
	transform: rotate(90deg);

	transform-origin: top center;

	position: absolute;
	right: 50%;
	top: 50%;
}

.visual-clocks--numbers {
	position: relative;
	top: -17px;
}
.visual-clocks--number-item {
	color: #555;
	line-height: 1;

	position: absolute;
	width: 200px;
	text-align: right;


	transform-origin: left center;
	font-size: 0;
}
.visual-clocks--number-item div {
	font-size: 30px;
	display: inline-block;
	
	
	margin-right: -5px;

}

.visual-clocks--dots {

}
.visual-clocks--dot-item {
	font-size: 0;
	position: absolute;
	width: 150px;
	text-align: right;

	-webkit-transform-origin: left center;
	-moz-transform-origin: left center;
	-ms-transform-origin: left center;
	-o-transform-origin: left center;
	transform-origin: left center;
}
.visual-clocks--dot-item:after {
	border-radius: 50%;
	content: "";
	display: inline-block;
	width: 1px;
	height: 1px;
	background-color: #000;
}
.visual-clocks--dot-item.num:after {
	-webkit-transform: scale(5);
	-ms-transform: scale(5);
	-o-transform: scale(5);
	transform: scale(5);
}

.visual-clocks--arrows {
	position: absolute;
	top: 50%;
	left: 50%;
}
.visual-clocks--arrow-item {
	position: absolute;

}

.visual-clocks--hour-arrow {
	left: -30px;
	top: -3px;
	background-color: #333;

	height: 6px;
	width: 120px;

	transform-origin: 30px center;
}
.visual-clocks--hour-arrow:after {
	position: absolute;
	right: -17px;
	top: 0px;
	content: "";
	border: 3px solid transparent;
	border-left: 15px solid #333;
}
.visual-clocks--minute-arrow {
	top: -2px;
	left: -30px;
	background-color: #666;

	height: 4px;
	width: 150px;

	transform-origin: 30px center;
}
.visual-clocks--minute-arrow:after {
	position: absolute;
	right: -15px;
	top: 0px;
	content: "";
	border: 2px solid transparent;
	border-left: 15px solid #666;
}
.visual-clocks--second-arrow {
	top: -1px;
	background-color: #f66;

	-webkit-transition: 1s linear;
	-o-transition: 1s linear;
	transition: 1s linear;

	height: 2px;
	width: 150px;
	
	transform-origin: 0 center;
}

.visual-clocks--pinner {
	top: -10px;
	left: -10px;
	z-index: 5;
	width: 20px;
	height: 20px;
	background-color: #399;

	border-radius: 50%;
}

              
            
!

JS

              
                var numberSingsBox = $(".visual-clocks--numbers");
var dotsSingsBox = $(".visual-clocks--dots");
var numberSignItemClassName = 'visual-clocks--number-item';
var dotSignItemClassName = 'visual-clocks--dot-item';


/* возврщает процент от значении от максимального числа */
function getPercentFromNumber(max, val){
	return ( (100 / max) * val );
}

var secondsDeg = 0;
var minutesDeg = 0;
var hoursDeg = 0;

/* Показ времени */
function showClocks(){
	var time = new Date();

	/* запускаем секунды */
	var seconds = time.getSeconds();
	if (seconds == 0) {
		secondsDeg += 60;
	}
	setDeg("visual-clocks--second-arrow",  6 * (seconds + secondsDeg + 1));
	/* ^^^^^^^^^^^^^^^^ */


	/* запускаем минуты */
	var minutes = time.getMinutes();
	var secPercent = getPercentFromNumber(60, time.getSeconds());

	setDeg("visual-clocks--minute-arrow", 6 * (minutes + minutesDeg + (secPercent / 100)));
	/* ^^^^^^^^^^^^^^^^ */

	/* запускаем часы */
	var hours = time.getHours();
	var minPercent = getPercentFromNumber(60, time.getMinutes());

	setDeg("visual-clocks--hour-arrow", 6 * (( hours + minPercent / 100) * 5));
	/* ^^^^^^^^^^^^^^^^ */

	/* Вызываем рекурсивно саму себя, чтобы время "тикала" */
	setTimeout(function(){
		showClocks();
	}, 1000);
}
/* Запускаем часы */
showClocks();

/* Устанавливает градус уклона на класс */
function setDeg(clsName, deg){
	$("." + clsName).css({
		"-webkit-transform" : "rotate(" + deg + "deg)",
		"-ms-transform" : "rotate(" + deg + "deg)",
		"-o-transform" : "rotate(" + deg + "deg)",
		"transform" : "rotate(" + deg + "deg)"
	});

	return deg;
}


function getDegForSing(number, step){
	if (!step) step = 30;
	var indexDeg = -90; /* изначальный градус наклона */
	var stepDeg = step; /* шаг */

	return indexDeg + (stepDeg * number);
}


/* Добавляет цифры вокруг часов */
function addNumberSigns(){
	var htmlSigns = '';
	for(var i = 1; i <= 12; i++){
		var deg = getDegForSing( i );
		var degBack = deg * -1;

		htmlSigns += '<div class="'+ numberSignItemClassName +'" style=" transform : rotate('+ deg +'deg);">\
						<div style="transform: rotate('+ degBack +'deg)">'+ i +'</div></div>';
	}
	numberSingsBox.html(htmlSigns);

	
}
addNumberSigns();

/* Добавляет доты/точки вокруг часов */
function addDotSigns(){
	var htmlSigns = '';
	for(var i = 1; i <= 60; i++){
		var deg = getDegForSing( i , 6 );
		if (i % 5 == 0)
			htmlSigns += '<div class="'+ dotSignItemClassName + ' num" style=" transform : rotate('+ deg +'deg);"></div>';
		else
			htmlSigns += '<div class="'+ dotSignItemClassName + '" style=" transform : rotate('+ deg +'deg);"></div>';
	}
	dotsSingsBox.html(htmlSigns);
}
addDotSigns();


              
            
!
999px

Console