Skip to content

Commit

Permalink
everything is woring properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jfreundlich01 committed May 16, 2022
1 parent ccf9319 commit 936e439
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5503
}
36 changes: 36 additions & 0 deletions clock.js
Original file line number Diff line number Diff line change
@@ -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)

7 changes: 7 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#clock {
position: relative;
}

#clock img {
position: absolute;

}


#hour {
position: absolute;
}

#minute {
position: absolute;
}

#second {
position: absolute;
}

0 comments on commit 936e439

Please sign in to comment.