File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 6161 background : black;
6262 position : absolute;
6363 top : 50% ;
64+ transform : rotate (90deg );
65+ transition-timing-function : ease-in-out;
66+ transform-origin : 100% ;
67+ transition-duration : 0.1s ;
6468 }
6569
6670 </ style >
6771
6872 < script >
73+ const secondHand = document . querySelector ( `.second-hand` ) ;
74+ const minuteHand = document . querySelector ( `.min-hand` ) ;
75+ const hourHand = document . querySelector ( `.hour-hand` ) ;
76+ function time ( ) {
77+ var date = new Date ( ) ;
78+ var seconds = 90 + date . getSeconds ( ) * 6
79+ secondHand . style . transform = `rotate(${ seconds } deg)` ;
6980
81+ var minutes = 90 + date . getMinutes ( ) * 6
82+ minuteHand . style . transform = `rotate(${ minutes } deg)` ;
83+
84+ var hours = 90 + date . getHours ( ) * 30
85+ hourHand . style . transform = `rotate(${ hours } deg)` ;
86+ }
87+
88+ setInterval ( time , 1000 ) ;
7089
7190 </ script >
7291</ body >
You can’t perform that action at this time.
0 commit comments