File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 62
62
background : black;
63
63
position : absolute;
64
64
top : 50% ;
65
+ transform-origin : 100% ;
66
+ transform : rotate (90deg );
67
+ /* transition: all 0.05s; */
68
+ transition-timing-function : ease-in-out;
65
69
}
66
70
67
71
</ style >
68
72
69
73
< script >
74
+ const secondHand = document . querySelector ( '.second-hand' )
75
+ const minsHand = document . querySelector ( '.min-hand' )
76
+ const hourHand = document . querySelector ( '.hour-hand' )
70
77
78
+ setDate = ( ) => {
79
+ const now = new Date ( )
80
+ const seconds = now . getSeconds ( )
81
+ const secondsDegrees = ( ( seconds / 60 ) * 360 ) + 90
82
+ secondHand . style . transform = `rotate(${ secondsDegrees } deg)`
83
+
84
+ const mins = now . getMinutes ( )
85
+ const minsDegrees = ( ( mins / 60 ) * 360 ) + 90
86
+ minsHand . style . transform = `rotate(${ minsDegrees } deg)`
87
+
88
+ const hours = now . getHours ( )
89
+ const hoursDegrees = ( ( hours / 60 ) * 360 ) + 90
90
+ hourHand . style . transform = `rotate(${ hoursDegrees } deg)`
91
+ console . log ( hours ) ;
92
+ }
71
93
94
+ setInterval ( setDate , 1000 )
72
95
</ script >
73
96
</ body >
74
97
</ html >
You can’t perform that action at this time.
0 commit comments