<section class="border-clock"></section>
<section class="clock">
<ul>
<li><i>12</i></li>
<li><i>1</i></li>
<li><i>2</i></li>
<li><i>3</i></li>
<li><i>4</i></li>
<li><i>5</i></li>
<li><i>6</i></li>
<li><i>7</i></li>
<li><i>8</i></li>
<li><i>9</i></li>
<li><i>10</i></li>
<li><i>11</i></li>
</ul>
<h2>ophelia</h2>
<h3>fournier-laflamme</h3>
<output class="date"></output>
<div class="minutes"></div>
<div class="hours"></div>
<div class="seconds"></div>
<div class="cercle"></div>
</section>
body{background: linear-gradient(-90deg, #2FC5BA, #62C6C9, #2FC5BA)}
i {
font-style: normal;
font-weight: bold;
font-size: 14px;
}
h2, h3 {
font-size: 7px;
letter-spacing: 1px;
font-variant: small-caps;
position: absolute;
left: 50%;
top: 32%;
transform: translateX(-50%);
}
h2 {
font-size: 8px;
top: 29%;
letter-spacing: 3px;
font-weight: bold;
}
.date {
font-size: 8px;
width: 32px;
height: 9px;
background-color: #F6EEE8;
border-radius: 2px;
text-align: center;
position: absolute;
left: 50%;
bottom: 27%;
transform: translateX(-50%);
}
section.border-clock {
background-color: #EBEB83;
width: 300px;
height: 300px;
border: 10px solid #F4F48E;
border-radius: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 15px 15px 35px -10px #488893;
}
section.clock {
width: 272px;
height: 272px;
background-color: #FDFAF7;
border: 2px solid #E5E375;
border-radius: 100%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
div.minutes, div.hours, div.seconds {
width: 1px;
height: 1px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
transform-origin: 50% 0;
}
div.minutes {transition: transform 1s linear}
div.seconds::before, div.minutes::before, div.hours::before {
content: "";
position: absolute;
bottom: 50%;
left: 50%;
transform-origin: 50% 0;
transform: translateX(-50%);
}
div.seconds::before {
width: 1px;
height: 113px;
background-color: #EB6444;
}
div.minutes::before {
width: 3px;
height: 105px;
background-color: #68C3D4;
border-radius: 3px;
}
div.hours::before {
width: 3px;
height: 80px;
background-color: #68C3D4;
border-radius: 3px;
}
.cercle {
width: 7px;
height: 7px;
background-color: #FDFAF7;
border: 2px solid #EB6444;
border-radius: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
span {
display: block;
width: 1px;
height: 95%;
position: absolute;
top: 50%;
left: 50%;
&::after {
content: "";
background-color: #A0A1A4;
position: absolute;
width: 100%;
height: 10px;
top: 0;
left: 0;
}
&::before {
content: "";
background-color: #A0A1A4;
position: absolute;
width: 100%;
height: 10px;
bottom: 0;
left: 0;
}
&.fives {
&::after,
&::before {height: 20px}
}
}
ul {
height: 38%;
width: 0;
position: absolute;
bottom: 50%;
left: 50%;
li {
height: 100%;
position: absolute;
top: 0;
left: 0;
transform-origin: 50% 100%;
i {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
&:nth-child(2) {
transform: rotate(30deg);
i {transform: translateX(-50%) rotate(-30deg)}
}
&:nth-child(3) {
transform: rotate(60deg);
i {transform: translateX(-50%) rotate(-60deg)}
}
&:nth-child(4) {
transform: rotate(90deg);
i {transform: translateX(-50%) rotate(-90deg)}
}
&:nth-child(5) {
transform: rotate(120deg);
i {transform: translateX(-50%) rotate(-120deg)}
}
&:nth-child(6) {
transform: rotate(150deg);
i {transform: translateX(-50%) rotate(-150deg)}
}
&:nth-child(7) {
transform: rotate(180deg);
i {transform: translateX(-50%) rotate(-180deg)}
}
&:nth-child(8) {
transform: rotate(210deg);
i {transform: translateX(-50%) rotate(-210deg)}
}
&:nth-child(9) {
transform: rotate(240deg);
i {transform: translateX(-50%) rotate(-240deg)}
}
&:nth-child(10) {
transform: rotate(270deg);
i {transform: translateX(-50%) rotate(-270deg)}
}
&:nth-child(11) {
transform: rotate(300deg);
i {transform: translateX(-50%) rotate(-300deg)}
}
&:last-child {
transform: rotate(330deg);
i {transform: translateX(-50%) rotate(-330deg)}
}
}
}
}
View Compiled
(function createSecondLines(){
var clock = document.querySelector(".clock");
var rotate = 0;
var byFive = function(n) {
return (n / 5 === parseInt(n / 5, 10)) ? true : false;
};
for (i=0; i < 30; i++) {
var span = document.createElement("span");
if (byFive(i)) {
span.className = "fives";
}
span.style.transform = "translate(-50%,-50%) rotate("+ rotate + "deg)";
clock.appendChild(span);
rotate += 6;
}
})();
(function setClock() {
var time = new Date();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
var clock = {
hours: document.querySelector('.hours'),
minutes: document.querySelector('.minutes'),
seconds: document.querySelector('.seconds')
};
var deg = {
hours: 30 * hours + .5 * minutes,
minutes: 6 * minutes + .1 * seconds,
seconds: 6 * seconds
}
clock.hours.style.transform = 'rotate(' + deg.hours + 'deg)';
clock.minutes.style.transform = 'rotate(' + deg.minutes + 'deg)';
clock.seconds.style.transform = 'rotate(' + deg.seconds + 'deg)';
var runClock = function(){
deg.hours += 360/43200;
deg.minutes += 360/3600;
deg.seconds += 360/60;
clock.hours.style.transform = 'rotate(' + deg.hours + 'deg)';
clock.minutes.style.transform = 'rotate(' + deg.minutes + 'deg)';
clock.seconds.style.transform = 'rotate(' + deg.seconds + 'deg)';
};
setInterval(runClock,1000);
(function printDate(){
var months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
var print = time.getDate() + ' / ' + months[time.getMonth()];
var output = document.querySelectorAll('output');
[].forEach.call(output, function(node){
node.innerHTML = print;
});
})();
})();