diff --git a/Analog Clock Using HTML CSS JS/clock.jpeg b/Analog Clock Using HTML CSS JS/clock.jpeg new file mode 100644 index 00000000..ce9ea51f Binary files /dev/null and b/Analog Clock Using HTML CSS JS/clock.jpeg differ diff --git a/Analog Clock Using HTML CSS JS/clock.jpg b/Analog Clock Using HTML CSS JS/clock.jpg new file mode 100644 index 00000000..63fabbd7 Binary files /dev/null and b/Analog Clock Using HTML CSS JS/clock.jpg differ diff --git a/Analog Clock Using HTML CSS JS/index.css b/Analog Clock Using HTML CSS JS/index.css new file mode 100644 index 00000000..767acc9b --- /dev/null +++ b/Analog Clock Using HTML CSS JS/index.css @@ -0,0 +1,43 @@ +#clockContainer{ + /* border: 2px solid red; */ + height: 42vw; + width: 42vw; + background: url('clock.jpg') no-repeat; + background-size: 100%; + margin: auto; + position: relative; +} + +#hour, #minute, #second{ + position: absolute; + /* background-color: black; */ + border-radius: 10px; + transform-origin: bottom; +} +#hour{ + opacity: 0.9; + width: 1.8%; + height: 25%; + top: 23%; + left: 48.48%; + background-color: #032639; + /* display: none; */ +} +#minute{ + width: 0.9%; + height: 31%; + top: 17%; + left: 49%; + opacity: 0.8; + background-color: rgb(63 4 4); + /* display: none; */ +} +#second{ + width: 0.6%; + height: 36%; + top: 12%; + left: 49.1%; + opacity: 0.7; + background-color: black; + /* display: none; */ +} \ No newline at end of file diff --git a/Analog Clock Using HTML CSS JS/index.html b/Analog Clock Using HTML CSS JS/index.html new file mode 100644 index 00000000..8a74ca95 --- /dev/null +++ b/Analog Clock Using HTML CSS JS/index.html @@ -0,0 +1,19 @@ + + + + + + + Clock Using Pure JS + + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/Analog Clock Using HTML CSS JS/index.js b/Analog Clock Using HTML CSS JS/index.js new file mode 100644 index 00000000..a2015162 --- /dev/null +++ b/Analog Clock Using HTML CSS JS/index.js @@ -0,0 +1,13 @@ +setInterval(() => { + d = new Date(); + htime = d.getHours(); + mtime = d.getMinutes(); + stime = d.getSeconds(); + hrotation = 30*htime + mtime/2; + mrotation = 6*mtime; + srotation = 6*stime; + + hour.style.transform = `rotate(${hrotation}deg)`; + minute.style.transform = `rotate(${mrotation}deg)`; + second.style.transform = `rotate(${srotation}deg)`; +}, 1000); \ No newline at end of file