summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-07-24 13:10:02 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-07-24 13:10:02 +0200
commit42e1d00c76897819abceeba40f24cf8c4a81364f (patch)
treefbab0ceb769d11f9609910bf1674737fceddf58a
parentadd pictures (diff)
downloadsite-42e1d00c76897819abceeba40f24cf8c4a81364f.tar.gz
site-42e1d00c76897819abceeba40f24cf8c4a81364f.zip
add js to background
-rw-r--r--index.html1
-rw-r--r--js/gradient.js53
-rw-r--r--styles.css53
3 files changed, 98 insertions, 9 deletions
diff --git a/index.html b/index.html
index c7f07d5..13e7b46 100644
--- a/index.html
+++ b/index.html
@@ -133,5 +133,6 @@
133 <p>Designed & Built by Salmon and AI</p> 133 <p>Designed & Built by Salmon and AI</p>
134 </div> 134 </div>
135 </footer> 135 </footer>
136 <script src="js/gradient.js"></script>
136</body> 137</body>
137</html> \ No newline at end of file 138</html> \ No newline at end of file
diff --git a/js/gradient.js b/js/gradient.js
new file mode 100644
index 0000000..1fe1e63
--- /dev/null
+++ b/js/gradient.js
@@ -0,0 +1,53 @@
1document.addEventListener('DOMContentLoaded', () => {
2 // Get the body element to update the cursor position
3 const body = document.documentElement;
4 let mouseX = 0;
5 let mouseY = 0;
6 let smoothX = 0;
7 let smoothY = 0;
8
9 // Smoothing factor (lower = smoother, higher = snappier)
10 const smoothing = 0.1;
11
12 // Handle mouse movement
13 const handleMouseMove = (e) => {
14 mouseX = e.clientX;
15 mouseY = e.clientY;
16 };
17
18 // Smooth the cursor movement
19 const updateCursorLight = () => {
20 // Apply smoothing
21 smoothX += (mouseX - smoothX) * smoothing;
22 smoothY += (mouseY - smoothY) * smoothing;
23
24 // Update CSS variables for the cursor position
25 body.style.setProperty('--cursor-x', `${smoothX}px`);
26 body.style.setProperty('--cursor-y', `${smoothY}px`);
27
28 // Continue the animation loop
29 requestAnimationFrame(updateCursorLight);
30 };
31
32 // Add event listeners
33 window.addEventListener('mousemove', handleMouseMove);
34
35 // Handle touch events for mobile
36 window.addEventListener('touchmove', (e) => {
37 e.preventDefault();
38 const touch = e.touches[0];
39 handleMouseMove({
40 clientX: touch.clientX,
41 clientY: touch.clientY
42 });
43 }, { passive: false });
44
45 // Initialize cursor position to center of screen
46 mouseX = window.innerWidth / 2;
47 mouseY = window.innerHeight / 2;
48 smoothX = mouseX;
49 smoothY = mouseY;
50
51 // Start the animation loop
52 updateCursorLight();
53});
diff --git a/styles.css b/styles.css
index 501b1c5..e3dd04d 100644
--- a/styles.css
+++ b/styles.css
@@ -1,21 +1,52 @@
1/* Base Styles */ 1/* Base Styles */
2:root { 2:root {
3 --primary: #3b82f6; 3 --cursor-x: 50%;
4 --primary-hover: #60a5fa; 4 --cursor-y: 50%;
5 --text: #e5e7eb;
6 --text-secondary: #9ca3af;
7 --bg: #111827; 5 --bg: #111827;
8 --bg-secondary: #1f2937; 6 --bg-secondary: #1f2937;
9 --bg-tertiary: #374151; 7 --bg-tertiary: #374151;
8 --text: #f9fafb;
9 --text-secondary: #d1d5db;
10 --primary: #3b82f6;
11 --primary-hover: #2563eb;
10 --border: #374151; 12 --border: #374151;
13 --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
11 --white: #ffffff; 14 --white: #ffffff;
12 --black: #111827; 15 --black: #111827;
13} 16}
14 17
15* { 18/* Base background and cursor light effect */
19html, body {
20 min-height: 100%;
16 margin: 0; 21 margin: 0;
17 padding: 0; 22 padding: 0;
18 box-sizing: border-box; 23 background: #111827; /* Base dark background */
24 overflow-x: hidden;
25 /* Default cursor is now visible */
26}
27
28/* Cursor light effect */
29body::before {
30 content: '';
31 position: fixed;
32 top: 0;
33 left: 0;
34 width: 100%;
35 height: 100%;
36 background: radial-gradient(
37 circle at var(--cursor-x, 50%) var(--cursor-y, 50%),
38 rgba(31, 41, 55, 0.8) 0%,
39 rgba(17, 24, 39, 0.95) 70%,
40 #111827 100%
41 );
42 pointer-events: none;
43 z-index: 0;
44}
45
46/* Ensure content is above the cursor effect */
47body > * {
48 position: relative;
49 z-index: 1;
19} 50}
20 51
21body { 52body {
@@ -75,7 +106,9 @@ nav {
75 display: flex; 106 display: flex;
76 align-items: center; 107 align-items: center;
77 padding: 8rem 0 4rem; 108 padding: 8rem 0 4rem;
78 background: linear-gradient(135deg, #111827 0%, #1f2937 100%); 109 position: relative;
110 overflow: hidden;
111 background: transparent;
79} 112}
80 113
81.hero-content { 114.hero-content {
@@ -179,7 +212,9 @@ section {
179/* About Section */ 212/* About Section */
180.about { 213.about {
181 padding: 6rem 0; 214 padding: 6rem 0;
182 background-color: var(--bg); 215 background: transparent;
216 position: relative;
217 z-index: 1;
183} 218}
184 219
185.about-content { 220.about-content {
@@ -220,7 +255,7 @@ section {
220 255
221/* Projects Section */ 256/* Projects Section */
222.projects { 257.projects {
223 background-color: var(--bg); 258 background: transparent;
224 padding: 6rem 0; 259 padding: 6rem 0;
225} 260}
226 261