Skip to content

Commit 55cf245

Browse files
committed
Completed exercise 2
1 parent 12a3ee6 commit 55cf245

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

‎02 - JS + CSS Clock/index-START.html‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,38 @@
6161
background:black;
6262
position: absolute;
6363
top:50%;
64+
transform-origin:100%;
65+
transform:rotate(90deg);
66+
transition: all 0.5s
67+
transition-timing-function: cubic-bezier(1,2.99,0.58,1);
68+
6469
}
6570

6671
</style>
67-
6872
<script>
69-
73+
setInterval(tick,1000)
74+
functiontick(){
75+
constdate=newDate();
76+
constseconds=date.getSeconds();
77+
secTick(date.getSeconds())
78+
minuteTick(date.getMinutes())
79+
hourTick(date.getHours())
80+
}
81+
functionsecTick(sec){
82+
constsecondsDegrees=sec*6;
83+
consthandSec=document.querySelector('.hand.second-hand');
84+
handSec.style.transform=`rotate(${secondsDegrees}deg)`;
85+
}
86+
functionminuteTick(min){
87+
constminDegrees=min*6;
88+
consthandMin=document.querySelector('.hand.min-hand');
89+
handMin.style.transform=`rotate(${minDegrees}deg)`;
90+
}
91+
functionhourTick(hour){
92+
consthourDegrees=hour*30;
93+
consthandHour=document.querySelector('.hand.hour-hand');
94+
handHour.style.transform=`rotate(${hourDegrees}deg)`;
95+
}
7096

7197
</script>
7298
</body>

0 commit comments

Comments
(0)