|
*, |
|
*::before, |
|
*::after { |
|
box-sizing: border-box; |
|
} |
|
|
|
body { |
|
display: flex; |
|
height: 100vh; |
|
margin: 0; |
|
background: #ececef; |
|
} |
|
|
|
$clock-size: 80vmin; |
|
|
|
$clock-color-bg: #fff; |
|
$clock-color-border: #dcdcdc; |
|
$clock-color-markers: #0e0e10; //RAL 9005 |
|
$clock-color-hands: #0e0e10; //RAL 9005 |
|
$clock-color-sec-hand: #bb1e10; //RAL 3020 |
|
|
|
$marker-hour-width: $clock-size / 100 * 3.5; |
|
$marker-hour-length: $clock-size / 100 * 12; |
|
|
|
$marker-min-width: $clock-size / 100 * 1.4; |
|
$marker-min-length: $marker-hour-width; |
|
|
|
$hand-hour-width-top: $clock-size / 100 * 5.2; |
|
$hand-hour-width-bottom: $clock-size / 100 * 6.4; |
|
$hand-hour-length: $clock-size / 100 * 44; |
|
$hand-hour-offset: $clock-size / 100 * 12; |
|
|
|
$hand-min-width-top: $clock-size / 100 * 3.6; |
|
$hand-min-width-bottom: $hand-hour-width-top; |
|
$hand-min-length: $clock-size / 100 * 58; |
|
$hand-min-offset: $clock-size / 100 * 12; |
|
|
|
$hand-sec-width: $clock-size / 100 * 1.4; |
|
$hand-sec-pointer-diameter: $clock-size / 100 * 10.5; |
|
$hand-sec-length: $clock-size / 100 * 47.7; |
|
$hand-sec-offset: $clock-size / 100 * 16.5; |
|
|
|
.clock { |
|
position: relative; |
|
min-width: $clock-size; |
|
min-height: $clock-size; |
|
margin: auto; |
|
background: $clock-color-bg; |
|
border-radius: 50%; |
|
box-shadow: |
|
0 0 0 $marker-min-length $clock-color-bg, |
|
0 0 0 $marker-min-length*1.5 $clock-color-border; |
|
|
|
.markers { |
|
width: 100%; |
|
height: 100%; |
|
|
|
&::before, |
|
&::after { |
|
content: ''; |
|
position: absolute; |
|
top: 50%; |
|
left: 50%; |
|
transform: translate(-50%, -50%); |
|
border-radius: 50%; |
|
background: $clock-color-bg; |
|
} |
|
|
|
&::before { |
|
z-index: 4; |
|
width: $clock-size - $marker-hour-length * 2; |
|
height: $clock-size - $marker-hour-length * 2; |
|
} |
|
|
|
&::after { |
|
z-index: 2; |
|
width: $clock-size - $marker-min-length * 2; |
|
height: $clock-size - $marker-min-length * 2; |
|
} |
|
|
|
[marker-hour] { |
|
z-index: 3; |
|
position: absolute; |
|
top: 0; |
|
left: 50%; |
|
width: $marker-hour-width; |
|
height: 100%; |
|
margin-left: -$marker-hour-width / 2; |
|
background: $clock-color-markers; |
|
} |
|
|
|
@for $i from 0 through 5 { |
|
[marker-hour="#{$i}-#{$i+6}"] { |
|
transform: rotate(#{$i*30}deg); |
|
} |
|
} |
|
|
|
[marker-min] { |
|
z-index: 1; |
|
position: absolute; |
|
top: 0; |
|
left: 50%; |
|
width: $marker-min-width; |
|
height: 100%; |
|
margin-left: -$marker-min-width / 2; |
|
background: $clock-color-markers; |
|
} |
|
|
|
@for $i from 1 through 29 { |
|
[marker-min="#{$i}-#{$i+30}"] { |
|
transform: rotate(#{$i*6}deg); |
|
} |
|
} |
|
} |
|
|
|
.hands { |
|
width: 100%; |
|
height: 100%; |
|
|
|
[hand] { |
|
z-index: 5; |
|
position: absolute; |
|
bottom: 50%; |
|
left: 50%; |
|
background: $clock-color-hands; |
|
} |
|
|
|
[hand="hour"] { |
|
bottom: calc(50% - #{$hand-hour-offset}); |
|
width: $hand-hour-width-bottom; |
|
height: $hand-hour-length; |
|
margin-left: -$hand-hour-width-bottom / 2; |
|
transform-origin: center #{$hand-hour-length - $hand-hour-offset}; |
|
clip-path: polygon( |
|
#{($hand-hour-width-bottom - $hand-hour-width-top) / 2} 0, |
|
#{$hand-hour-width-bottom - ($hand-hour-width-bottom - $hand-hour-width-top) / 2} 0, |
|
100% 100%, |
|
0 100% |
|
); |
|
} |
|
|
|
[hand="min"] { |
|
bottom: calc(50% - #{$hand-min-offset}); |
|
width: $hand-min-width-bottom; |
|
height: $hand-min-length; |
|
margin-left: -$hand-min-width-bottom / 2; |
|
transform-origin: center #{$hand-min-length - $hand-min-offset}; |
|
clip-path: polygon( |
|
#{($hand-min-width-bottom - $hand-min-width-top) / 2} 0, |
|
#{$hand-min-width-bottom - ($hand-min-width-bottom - $hand-min-width-top) / 2} 0, |
|
100% 100%, |
|
0 100% |
|
); |
|
} |
|
|
|
[hand="sec"] { |
|
bottom: calc(50% - #{$hand-sec-offset}); |
|
width: $hand-sec-width; |
|
height: $hand-sec-length; |
|
margin-left: -$hand-sec-width / 2; |
|
background: $clock-color-sec-hand; |
|
transform-origin: center #{$hand-sec-length - $hand-sec-offset}; |
|
|
|
&::after { |
|
content: ''; |
|
position: absolute; |
|
top: 0; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
width: $hand-sec-pointer-diameter; |
|
height: $hand-sec-pointer-diameter; |
|
background: inherit; |
|
border-radius: 50%; |
|
} |
|
} |
|
} |
|
} |