From 1a9c1c445c5c24e5daede43088f30a38829bdb89 Mon Sep 17 00:00:00 2001 From: MrEidam Date: Tue, 26 Sep 2023 19:10:29 +0200 Subject: [PATCH] V3 - Added Time --- .gitignore | 1 + index.html | 23 +++++++++++++++++++++++ main.js | 48 ++++++++++++++++++++++-------------------------- style.css | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 26 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/index.html b/index.html index 6a3d56d..f1469c3 100644 --- a/index.html +++ b/index.html @@ -29,6 +29,29 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/main.js b/main.js index b6db210..6331bdf 100644 --- a/main.js +++ b/main.js @@ -1,21 +1,3 @@ -/*function CColor(color){ - document.querySelectorAll('.side').forEach((element) => { - element.style.background = - 'linear-gradient(to bottom, #151515, '+color+')'; - }); - document.getElementById('top').style.setProperty('--color', color); - - //before.style.setProperty('--color',color) - - // active marking - document.getElementsByClassName('cl').forEach(function(item){ - item.classList.remove('active'); - }) - event.target.classList.add('active'); - - - -}*/ let Shadow function CColor(color, rgb) { // Change the background of elements with the class 'side' @@ -37,16 +19,14 @@ function CColor(color, rgb) { d:`,0 0 400px rgba(${rgb}0.8)`, e:`,0 0 500px rgba(${rgb}1) ;`} - document.getElementById('before').style.setProperty('--sh', `${Shadow.a}${Shadow.b}${Shadow.c}${Shadow.d}${Shadow.e}`); - - // Construct the box-shadow property - const boxShadowValue = `0 0 120px rgba(${rgb}, 0.2), 0 0 200px rgba(${rgb}, 0.4), 0 0 300px rgba(${rgb}, 0.6), 0 0 400px rgba(${rgb}, 0.8), 0 0 500px rgba(${rgb}, 1)`; - - // Set the box-shadow property directly - document.getElementById('before').style.boxShadow = boxShadowValue;*/ + document.getElementById('before').style.setProperty('--sh', `${Shadow.a}${Shadow.b}${Shadow.c}${Shadow.d}${Shadow.e}`);*/ // Shadow - Shadow = `0 0 120px ${color+'33'},0 0 200px ${color+'66'},0 0 300px ${color+'99'},0 0 400px ${color+'cc'}` + Shadow = ` + 0 0 120px ${color+'33'}, + 0 0 200px ${color+'66'}, + 0 0 300px ${color+'99'}, + 0 0 400px ${color+'cc'}` let Shadow4 = `,0 0 500px ${color};` before.style.boxShadow = Shadow// + Shadow4 @@ -60,3 +40,19 @@ function CColor(color, rgb) { event.target.classList.add('active'); console.log(Shadow); } + +// Clock + +let hours = document.getElementById('hour'); +let minutes = document.getElementById('minutes'); +let seconds = document.getElementById('seconds'); + +setInterval(() => { + let h = new Date().getHours(); + let m = new Date().getMinutes(); + let s = new Date().getSeconds(); + + hours.innerHTML = h; + minutes.innerHTML = m; + seconds.innerHTML = s; +}) \ No newline at end of file diff --git a/style.css b/style.css index caa9917..a799931 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,9 @@ +@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap'); *{ margin: 0; padding: 0; box-sizing: border-box; + user-select: none; transition: 0.5s; } body{ @@ -106,4 +108,56 @@ body{ filter: drop-shadow(2px 2px 4px #888); scale: 1.5; transition: 0.5s; +} +.clock{ + position: absolute; + top: 69px; + display: flex; + gap: 10px; + font-family: 'Anton', sans-serif; +} +.clock .digital{ + position: relative; + width: 60px; + height: 120px;/* + box-shadow: 20px 20px 20px -10px rgba(0,0,0,0.15), + inset 15px 15px 10px rgba(255,255,255,0.5), + -15px -15px 35px rgba(255,255,255,0.35), + inset -1px -1px 10px rgba(0,0,0,0.2);*/ +} +.clock .digital .screen{ + position: absolute; + inset: 20px;/* + box-shadow: 5px 5px 15px 0 #152b4a66, + inset 5px 5px 5px rgba(200,200,200,0.35), + 5px 5px 15px rgba(255,255,255,1);*/ +} +.clock .digital .screen::before{ + content: attr(data-text); + position: absolute; + bottom: -2.5px; + left: 50%; + transform: translateX(-50%) scale(0.75); + letter-spacing: 0.05em; + color: #aaa; + text-transform: uppercase; + +} +.clock .digital .time{ + position: absolute; + inset: 0; + display: flex; + justify-content: center; + align-items: center; +} +.clock .digital .time div{ + position: relative; + font-size: 2.9em; + color: var(--clr); + letter-spacing: 0.1em; + margin-left: 0.1em; +} +.clock .digital:nth-last-child(1) .time div{ + color: transparent; + -webkit-text-stroke: 2px var(--clr); } \ No newline at end of file