From 936e4391ad18df06dd8615216ed35c68b6337451 Mon Sep 17 00:00:00 2001 From: Jfreundlich01 Date: Mon, 16 May 2022 18:23:20 -0400 Subject: [PATCH] everything is woring properly --- .vscode/settings.json | 3 +++ clock.js | 36 ++++++++++++++++++++++++++++++++++++ style.css | 7 +++++++ 3 files changed, 46 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..155422b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5503 +} \ No newline at end of file diff --git a/clock.js b/clock.js index e69de29..d2cc028 100644 --- a/clock.js +++ b/clock.js @@ -0,0 +1,36 @@ +const hourHand = document.getElementById("hour"); +const minuteHand = document.getElementById("minute"); +const secondHand = document.getElementById("second"); + +//function runs clock +function clockRun(){ + //creates date. Accesses current day and time + const date = new Date(); + //console.log(date) + + //creates hour variable. Prints to military time so out of 24 + let hours = date.getHours() + //console.log(hours) + + //creates minute variable. Prints 0-60. + let minutes = date.getMinutes() + //console.log(minutes) + + // creates seconds variable. Prints 0-60 + let seconds = date.getSeconds() + + //console.log(seconds); + + //gets the seconds to run!! + secondHand.style.transform = "rotate(" + ((seconds/60)*360) + "deg)" + + //get the minutes to run!! + minuteHand.style.transform = "rotate(" + ((minutes/60)*360) + "deg)" + + //gert the hours to run! + hourHand.style.transform = "rotate(" + ((hours/12)*360) + "deg)" + +} + +setInterval(clockRun,1000) + diff --git a/style.css b/style.css index 60816ef..a22c473 100644 --- a/style.css +++ b/style.css @@ -1,14 +1,21 @@ #clock { + position: relative; } #clock img { + position: absolute; + } + #hour { + position: absolute; } #minute { + position: absolute; } #second { + position: absolute; }