Skip to content

Commit 2b8b281

Browse files
committed
two complete
1 parent ca38117 commit 2b8b281

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,40 @@
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>

0 commit comments

Comments
 (0)