-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
176 lines (156 loc) · 5.64 KB
/
script.js
File metadata and controls
176 lines (156 loc) · 5.64 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// GbitCode Interactive Enhancements
document.addEventListener('DOMContentLoaded', () => {
// Tool Cards Animation on Scroll
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -100px 0px'
};
const cardObserver = new IntersectionObserver((entries) => {
entries.forEach((entry, index) => {
if (entry.isIntersecting) {
setTimeout(() => {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}, index * 100);
cardObserver.unobserve(entry.target);
}
});
}, observerOptions);
// Initialize cards with animation
const toolCards = document.querySelectorAll('.tool-card');
toolCards.forEach(card => {
card.style.opacity = '0';
card.style.transform = 'translateY(30px)';
card.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
cardObserver.observe(card);
});
// Enhanced hover effect for tool cards
toolCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transition = 'all 0.3s ease';
// Add subtle glow animation
const glowAnimation = this.animate([
{ boxShadow: '0 0 20px rgba(0, 255, 0, 0.2)' },
{ boxShadow: '0 0 40px rgba(0, 255, 0, 0.4)' }
], {
duration: 300,
fill: 'forwards'
});
});
card.addEventListener('mouseleave', function() {
this.animate([
{ boxShadow: '0 0 40px rgba(0, 255, 0, 0.4)' },
{ boxShadow: '0 0 20px rgba(0, 255, 0, 0)' }
], {
duration: 300,
fill: 'forwards'
});
});
});
// Terminal-style cursor effect for links
const toolLinks = document.querySelectorAll('.tool-link');
toolLinks.forEach(link => {
link.addEventListener('mouseenter', function() {
const icon = this.querySelector('.link-icon');
if (icon) {
icon.style.transition = 'transform 0.3s ease';
icon.style.transform = 'translateX(5px)';
}
});
link.addEventListener('mouseleave', function() {
const icon = this.querySelector('.link-icon');
if (icon) {
icon.style.transform = 'translateX(0)';
}
});
});
// Logo animation on hover
const logo = document.querySelector('.logo-placeholder');
if (logo) {
let rotationAngle = 0;
logo.addEventListener('mouseenter', function() {
const animation = this.animate([
{ transform: 'scale(1) rotate(0deg)' },
{ transform: 'scale(1.05) rotate(5deg)' }
], {
duration: 300,
fill: 'forwards',
easing: 'ease-out'
});
});
logo.addEventListener('mouseleave', function() {
this.animate([
{ transform: 'scale(1.05) rotate(5deg)' },
{ transform: 'scale(1) rotate(0deg)' }
], {
duration: 300,
fill: 'forwards',
easing: 'ease-in'
});
});
}
// Add typing effect to title (optional)
const title = document.querySelector('.title');
if (title) {
const originalText = title.textContent;
title.textContent = '';
title.style.opacity = '1';
let charIndex = 0;
const typingSpeed = 100;
function typeWriter() {
if (charIndex < originalText.length) {
title.textContent += originalText.charAt(charIndex);
charIndex++;
setTimeout(typeWriter, typingSpeed);
}
}
// Start typing effect after a short delay
setTimeout(typeWriter, 500);
}
// Smooth scroll for internal links (if any are added later)
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Add matrix-style background effect on mouse move
let mouseX = 0;
let mouseY = 0;
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
});
// Footer links animation
const footerLinks = document.querySelectorAll('.footer-link');
footerLinks.forEach(link => {
link.addEventListener('mouseenter', function() {
this.style.transition = 'all 0.3s ease';
this.animate([
{ transform: 'translateX(0)' },
{ transform: 'translateX(10px)' }
], {
duration: 300,
fill: 'forwards'
});
});
link.addEventListener('mouseleave', function() {
this.animate([
{ transform: 'translateX(10px)' },
{ transform: 'translateX(0)' }
], {
duration: 300,
fill: 'forwards'
});
});
});
// Add console message for fun
console.log('%c Welcome to GbitCode! ', 'background: #00ff00; color: #0a0a0a; font-size: 20px; font-weight: bold;');
console.log('%c Developed with ❤️ by the GbitCode team ', 'background: #0a0a0a; color: #00ff00; font-size: 12px;');
});