File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 25
25
font-size : 10px ;
26
26
}
27
27
28
+ span {
29
+ color : red;
30
+ text-transform : uppercase;
31
+ font-size : 10px ;
32
+ }
33
+
28
34
body {
29
35
font-size : 2rem ;
30
36
display : flex;
61
67
background : black;
62
68
position : absolute;
63
69
top : 50% ;
70
+ transform-origin : 100% ;
71
+ transform : rotate (90deg );
72
+ transition : all 0.2s cubic-bezier (0.56 , 1.71 , 0.25 , 1 )
64
73
}
65
74
66
75
</ style >
67
76
68
77
< script >
78
+ const secondHand = document . querySelector ( '.second-hand' ) ;
79
+ const minHand = document . querySelector ( '.min-hand' ) ;
80
+ const hourHand = document . querySelector ( '.hour-hand' ) ;
81
+
82
+ function setDate ( ) {
83
+ const now = new Date ( ) ;
84
+
85
+ const seconds = now . getSeconds ( ) ;
86
+ const secondsDegrees = ( seconds / 60 ) * 360 + 90 ;
87
+ secondHand . style . transform = "rotate(" + secondsDegrees + "deg)" ;
88
+
89
+ const mins = now . getMinutes ( ) ;
90
+ const minDegrees = ( mins / 60 ) * 360 + 90 ;
91
+ minHand . style . transform = "rotate(" + minDegrees + "deg)" ;
69
92
93
+ const hours = now . getHours ( ) ;
94
+ const hoursDegrees = ( hours / 12 ) * 360 + 90 ;
95
+ hourHand . style . transform = "rotate(" + hoursDegrees + "deg)" ;
96
+ }
70
97
98
+ setInterval ( setDate , 1000 )
71
99
</ script >
72
100
</ body >
73
101
</ html >
You can’t perform that action at this time.
0 commit comments