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 6161 background : black;
6262 position : absolute;
6363 top : 50% ;
64+ transform-origin : 100% ;
65+ transform : rotate (90deg );
66+ transition : all 0.05s ;
67+ /* transition-timing-function: cubic-bezier: adjusts appearance of motion*/
68+ transition-timing-function : cubic-bezier (.1 , 2.7 , .58 , 1 );
6469 }
6570
6671 </ style >
6772
6873 < script >
6974
75+ const secondHand = document . querySelector ( '.second-hand' ) ;
76+ const minuteHand = document . querySelector ( '.min-hand' ) ;
77+ const hourHand = document . querySelector ( '.hour-hand' ) ;
78+
79+ function setDate ( ) {
80+ console . log ( 'Hi' ) ;
81+ const now = new Date ( ) ;
82+ const seconds = now . getSeconds ( ) ;
83+ const minutes = now . getMinutes ( ) ;
84+ const hours = now . getHours ( ) ;
85+
86+ console . log ( seconds ) ;
87+ const secondsDegs = ( ( seconds / 60 ) * 360 ) + 90 ;
88+ secondHand . style . transform = `rotate(${ secondsDegs } deg` ;
89+
90+ const minsDegs = ( ( minutes / 60 ) * 360 ) + 90 ;
91+ minuteHand . style . transform = `rotate(${ minsDegs } deg` ;
92+
93+ const hoursDegs = ( ( hours / 12 ) * 360 ) + 90 ;
94+ hourHand . style . transform = `rotate(${ hoursDegs } deg` ;
95+ }
96+
97+ setInterval ( setDate , 1000 ) ;
7098
7199 </ script >
72100</ body >
You can’t perform that action at this time.
0 commit comments