Visitar URL original
Move files to dist folder to deploy · wesbos/JavaScript30@dc04d3e · GitHub
Skip to content

Commit dc04d3e

Browse files
committed
Move files to dist folder to deploy
1 parent 13817c6 commit dc04d3e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 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.05s;
67+
transition-timing-function: cubic-bezier(0.01, 0.01, 0.98, 0.98);
6468
}
6569

6670
</style>
6771

6872
<script>
73+
const hourHand = document.querySelector('.hour-hand');
74+
const minHand = document.querySelector('.min-hand');
75+
const secondHand = document.querySelector('.second-hand');
6976

77+
function setDate() {
78+
const now = new Date();
79+
80+
const seconds = now.getSeconds();
81+
const secondsDegrees = ((seconds / 60) * 360) + 90;
82+
secondHand.style.transform = `rotate(${secondsDegrees}deg)`;
83+
84+
const mins = now.getMinutes();
85+
const minutesDegrees = ((mins / 60) * 360) + 90;
86+
minHand.style.transform = `rotate(${minutesDegrees}deg)`;
87+
88+
const hours = now.getHours();
89+
const hoursDegrees = ((hours / 12) * 360) + 90;
90+
hourHand.style.transform = `rotate(${hoursDegrees}deg)`;
91+
92+
console.log(seconds);
93+
}
94+
95+
setInterval(setDate, 1000)
7096

7197
</script>
7298
</body>

0 commit comments

Comments
 (0)