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+ /*puts pivot point on very right hand side*/
65+ /*transform-origin: 100%;*/
66+ /*sets default 12 o'clock position*/
67+ /*transform: rotate(90deg);*/
68+ /*transition: all 0.5s;*/
69+ transform-origin : 100% ;
70+ transform : rotate (90deg );
71+ transition : all 0.05s ;
72+ transition-timing-function : cubic-bezier (0.1 , 2.7 , 0.58 , 1 );
6473 }
6574
6675 </ style >
6776
6877 < script >
78+ const secondHand = document . querySelector ( '.second-hand' ) ;
79+ const hourHand = document . querySelector ( '.hour-hand' ) ;
80+ const minuteHand = document . querySelector ( '.min-hand' ) ;
6981
82+ function setDate ( ) {
83+ const now = new Date ( ) ;
84+ const seconds = now . getSeconds ( ) ;
85+ const secondsDegrees = ( ( seconds / 60 ) * 360 ) + 90 ;
86+ secondHand . style . transform = `rotate(${ secondsDegrees } deg)` ;
7087
88+ const mins = now . getMinutes ( ) ;
89+ const minsDegrees = ( ( mins / 60 ) * 360 ) + 90 ;
90+ minuteHand . style . transform = `rotate(${ minsDegrees } deg)`
91+
92+ const hour = now . getHours ( ) ;
93+ const hourDegrees = ( ( hour / 12 ) * 360 ) + 90 ;
94+ hourHand . style . transform = `rotate(${ hourDegrees } deg)`
95+ console . log ( seconds ) ;
96+ }
97+
98+ setInterval ( setDate , 1000 ) ;
7199 </ script >
72100</ body >
73101</ html >
You can’t perform that action at this time.
0 commit comments