Skip to content

Commit 0c1a5b8

Browse files
committed
2 parents e70b97a + 38a754c commit 0c1a5b8

File tree

5 files changed

+67
-31
lines changed

5 files changed

+67
-31
lines changed

02 - JS + CSS Clock/index-FINISHED.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Document</title>
5+
<title>JS + CSS Clock</title>
66
</head>
77
<body>
88

@@ -84,7 +84,7 @@
8484
const minsDegrees = ((mins / 60) * 360) + 90;
8585
minsHand.style.transform = `rotate(${minsDegrees}deg)`;
8686

87-
const hour = now.getMinutes();
87+
const hour = now.getHours();
8888
const hourDegrees = ((mins / 12) * 360) + 90;
8989
hourHand.style.transform = `rotate(${hourDegrees}deg)`;
9090
}

02 - JS + CSS Clock/index-START.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Document</title>
5+
<title>JS + CSS Clock</title>
66
</head>
77
<body>
88

02 - JS + CSS Clock/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Document</title>
5+
<title>JS + CSS Clock</title>
66
</head>
77
<body>
88

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Mouse Shadow</title>
6+
</head>
7+
<body>
8+
9+
<div class="hero">
10+
<h1 contenteditable>🔥WOAH!</h1>
11+
</div>
12+
13+
<style>
14+
html {
15+
color:black;
16+
font-family: sans-serif;
17+
}
18+
19+
.hero {
20+
min-height: 100vh;
21+
display:flex;
22+
justify-content: center;
23+
align-items: center;
24+
color:black;
25+
}
26+
27+
28+
h1 {
29+
text-shadow: 10px 10px 0 rgba(0,0,0,1);
30+
font-size: 100px;
31+
}
32+
</style>
33+
34+
<script>
35+
const hero = document.querySelector('.hero');
36+
const text = hero.querySelector('h1');
37+
const walk = 500; // 100px
38+
39+
function shadow(e) {
40+
const { offsetWidth: width, offsetHeight: height } = hero;
41+
let { offsetX: x, offsetY: y } = e;
42+
43+
if (this !== e.target) {
44+
x = x + e.target.offsetLeft;
45+
y = y + e.target.offsetTop;
46+
}
47+
48+
const xWalk = Math.round((x / width * walk) - (walk / 2));
49+
const yWalk = Math.round((y / height * walk) - (walk / 2));
50+
51+
text.style.textShadow = `
52+
${xWalk}px ${yWalk}px 0 rgba(255,0,255,0.7),
53+
${xWalk * -1}px ${yWalk}px 0 rgba(0,255,255,0.7),
54+
${yWalk}px ${xWalk * -1}px 0 rgba(0,255,0,0.7),
55+
${yWalk * -1}px ${xWalk}px 0 rgba(0,0,255,0.7)
56+
`;
57+
58+
}
59+
60+
hero.addEventListener('mousemove', shadow);
61+
</script>
62+
</body>
63+
</html>

16 - Mouse Move Shadow/index-start.html

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,13 @@ <h1 contenteditable>🔥WOAH!</h1>
2424
color:black;
2525
}
2626

27-
2827
h1 {
2928
text-shadow: 10px 10px 0 rgba(0,0,0,1);
3029
font-size: 100px;
3130
}
3231
</style>
3332

3433
<script>
35-
const hero = document.querySelector('.hero');
36-
const text = hero.querySelector('h1');
37-
const walk = 500; // 100px
38-
39-
function shadow(e) {
40-
const { offsetWidth: width, offsetHeight: height } = hero;
41-
let { offsetX: x, offsetY: y } = e;
42-
43-
if (this !== e.target) {
44-
x = x + e.target.offsetLeft;
45-
y = y + e.target.offsetTop;
46-
}
47-
48-
const xWalk = Math.round((x / width * walk) - (walk / 2));
49-
const yWalk = Math.round((y / height * walk) - (walk / 2));
50-
51-
text.style.textShadow = `
52-
${xWalk}px ${yWalk}px 0 rgba(255,0,255,0.7),
53-
${xWalk * -1}px ${yWalk}px 0 rgba(0,255,255,0.7),
54-
${yWalk}px ${xWalk * -1}px 0 rgba(0,255,0,0.7),
55-
${yWalk * -1}px ${xWalk}px 0 rgba(0,0,255,0.7)
56-
`;
57-
58-
}
59-
60-
hero.addEventListener('mousemove', shadow);
6134
</script>
6235
</body>
6336
</html>

0 commit comments

Comments
 (0)