diff --git a/clock.js b/clock.js index d2cc028..4bd89fe 100644 --- a/clock.js +++ b/clock.js @@ -6,7 +6,7 @@ const secondHand = document.getElementById("second"); function clockRun(){ //creates date. Accesses current day and time const date = new Date(); - //console.log(date) + console.log(date) //creates hour variable. Prints to military time so out of 24 let hours = date.getHours() @@ -19,16 +19,20 @@ function clockRun(){ // creates seconds variable. Prints 0-60 let seconds = date.getSeconds() + let secondRotation = (seconds/60) + let minuteRotation = (minutes/60) + let hourRotation = (((minuteRotation) + hours)/12) + //console.log(seconds); //gets the seconds to run!! - secondHand.style.transform = "rotate(" + ((seconds/60)*360) + "deg)" + secondHand.style.transform = "rotate(" + (secondRotation * 360) + "deg)" //get the minutes to run!! - minuteHand.style.transform = "rotate(" + ((minutes/60)*360) + "deg)" + minuteHand.style.transform = "rotate(" + (minuteRotation * 360) + "deg)" //gert the hours to run! - hourHand.style.transform = "rotate(" + ((hours/12)*360) + "deg)" + hourHand.style.transform = "rotate(" + (hourRotation * 360) + "deg)" }