Skip to content

Commit dd3058b

Browse files
committed
Completed exercise 02
1 parent 4e3128e commit dd3058b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,36 @@
6161
background:black;
6262
position: absolute;
6363
top:50%;
64-
transform-origin:100%;
64+
transform-origin:right; /*same as transform-origin:100%. Use values over 100% to transfrom about a point off the object*/
6565
transform:rotate(90deg);
6666
transition: all 0.05s;
67-
transition-timing-function:cubic-bezier(0.1,2.7,0.58,1);
67+
transition-timing-function:cubic-bezier(0,2.7,0.58,1);
6868
}
69-
</style>
7069

71-
<script>
72-
constsecondHand=document.querySelector('.second-hand');
73-
constminsHand=document.querySelector('.min-hand');
74-
consthourHand=document.querySelector('.hour-hand');
70+
</style>
7571

76-
functionsetDate(){
77-
constnow=newDate();
72+
<script>
7873

79-
constseconds=now.getSeconds();
80-
constsecondsDegrees=((seconds/60)*360)+90;
81-
secondHand.style.transform=`rotate(${secondsDegrees}deg)`;
74+
constsecondHand=document.querySelector('.second-hand');
75+
constminuteHand=document.querySelector('.min-hand');
76+
consthourHand=document.querySelector('.hour-hand');
8277

83-
constmins=now.getMinutes();
84-
constminsDegrees=((mins/60)*360)+90;
85-
minsHand.style.transform=`rotate(${minsDegrees}deg)`;
86-
87-
consthour=now.getMinutes();
88-
consthourDegrees=((mins/12)*360)+90;
89-
hourHand.style.transform=`rotate(${hourDegrees}deg)`;
90-
}
78+
functionsetDate(){
79+
constnow=newDate();
80+
constseconds=now.getSeconds();
81+
constminutes=now.getMinutes();
82+
consthours=now.getHours();
83+
constsecondsDegrees=(seconds*6)+90/*(seconds/60 * 360) = seconds * 6)*/
84+
constminutesDegrees=(minutes*6)+90
85+
consthoursDegrees=(hours*30)+90/*360/12 = 30 */
86+
secondHand.style.transform=`rotate(${secondsDegrees}deg)`;
87+
minuteHand.style.transform=`rotate(${minutesDegrees}deg)`;
88+
hourHand.style.transform=`rotate(${hoursDegrees}deg)`;
89+
}
9190

92-
setInterval(setDate,1000);
91+
setInterval(setDate,1000);/*built in function that runs a function at a given period
92+
document.querySelector(`.second-hand');*/
9393

94-
</script>
94+
</script>
9595
</body>
9696
</html>

0 commit comments

Comments
(0)