-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
102 lines (90 loc) · 4.24 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Andy Schwab - Links</title>
<meta name="description" content="Links to Andy Schwab's online presence">
<meta name="author" content="Andy Schwab">
<link rel="icon" href="./images/200px-Beret_Guy.png" type="image/x-icon">
<link href="styles.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=VT323&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
</head>
<body>
<div class="max-w-md">
<!-- Profile Section -->
<div class="profile-section">
<img src="./images/andyschwab-photo.jpeg" alt="Profile Picture" class="profile-image">
<h1>Andy Schwab</h1>
<p>takes a long time writing short emails</p>
</div>
<!-- Links Section -->
<div class="links-section">
<a href="https://blog.andyschwab.link" target="_blank" rel="noopener noreferrer"><i class="fa-solid fa-blog"></i>Blog</a>
<a href="https://github.com/andyschwab" target="_blank" rel="me noopener noreferrer"><i class="fa-brands fa-github"></i>GitHub</a>
<a href="https://linkedin.com/in/andrewsch" target="_blank" rel="noopener noreferrer"><i class="fa-brands fa-linkedin"></i>LinkedIn</a>
<a href="https://bsky.app/profile/andyschwab.link" target="_blank" rel="me noopener noreferrer"><i class="fa-solid fa-square-rss"></i>BlueSky</a>
<!-- <a href="" target="_blank" rel="noopener noreferrer"><i class="fa-solid fa-file-lines"></i>Resume</a> -->
<a href="mailto:[email protected]" rel="me"><i class="fa-solid fa-envelope"></i>Email</a>
</div>
</div>
<div class="bottom-menu">
<a href="https://rustpad.io/" target="_blank" rel="noopener noreferrer">
<i class="fa-regular fa-file-lines"></i>
</a>
<a href="https://puter.com/" target="_blank" rel="noopener noreferrer">
<i class="fa-solid fa-angle-right"></i>
</a>
</div>
<script>
const image = document.querySelector('.profile-image');
const maxDistance = 250;
const triggerDistance = 100;
// Helper function to handle both mouse and touch events
function handleMovement(clientX, clientY) {
const imageRect = image.getBoundingClientRect();
const imageCenterX = imageRect.left + (imageRect.width / 2);
const imageCenterY = imageRect.top + (imageRect.height / 2);
const deltaX = clientX - imageCenterX;
const deltaY = clientY - imageCenterY;
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
if (distance < triggerDistance) {
const factor = Math.pow((triggerDistance - distance) / triggerDistance, 1.5);
const moveX = (deltaX / distance) * -maxDistance * factor;
const moveY = (deltaY / distance) * -maxDistance * factor;
image.style.transform = `translate(${moveX}px, ${moveY}px)`;
} else {
image.style.transform = 'translate(0, 0)';
}
}
// Mouse events
document.addEventListener('mousemove', (e) => {
handleMovement(e.clientX, e.clientY);
});
// Touch events
document.addEventListener('touchmove', (e) => {
const touch = e.touches[0];
if (e.target === image) {
e.preventDefault(); // Only prevent default when touching the image
handleMovement(touch.clientX, touch.clientY);
}
}, { passive: false });
document.addEventListener('touchstart', (e) => {
const touch = e.touches[0];
if (e.target === image) {
e.preventDefault(); // Only prevent default when touching the image
handleMovement(touch.clientX, touch.clientY);
}
}, { passive: false });
// Reset function
function resetImagePosition() {
image.style.transform = 'translate(0, 0)';
}
// Reset events
['mouseleave', 'touchend', 'touchcancel'].forEach(eventType => {
document.addEventListener(eventType, resetImagePosition);
});
</script>
</body>
</html>