File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 < div class ="hand second-hand "> </ div >
1515 </ div >
1616 </ div >
17-
17+ < label for =""> Rate</ label >
18+ < input type ="opti ">
1819
1920 < style >
2021 html {
6162 background : black;
6263 position : absolute;
6364 top : 50% ;
65+ transform-origin : 100% ;
66+ transform : rotate (90deg );
67+ transform : all 0.05s ;
68+ transition-timing-function : cubic-bezier (0.1 , 2.7 .58 , 1 );
6469 }
6570
6671 </ style >
67-
6872 < script >
6973
74+ const hrHand = document . querySelector ( '.hour-hand' )
75+ const minHand = document . querySelector ( '.min-hand' )
76+ const secHand = document . querySelector ( '.second-hand' )
77+
78+ const setDate = ( ) => {
79+ const now = new Date ( ) ;
80+ const hours = now . getHours ( ) ;
81+ const minutes = now . getMinutes ( ) ;
82+ const seconds = now . getSeconds ( ) ;
83+ const hrDegree = ( hours / 12 ) * 360 + 90 ;
84+ const minDegree = ( minutes / 60 ) * 360 + 90 ;
85+ const secDegree = ( seconds / 60 ) * 360 + 90 ;
86+ hrHand . style . transform = `rotate(${ hrDegree } deg)`
87+ minHand . style . transform = `rotate(${ minDegree } deg)`
88+ secHand . style . transform = `rotate(${ secDegree } deg)`
89+ }
90+
91+ setInterval ( setDate , 1000 )
7092
7193 </ script >
7294</ body >
You can’t perform that action at this time.
0 commit comments