-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
214 lines (182 loc) · 6.75 KB
/
Copy pathscript.js
File metadata and controls
214 lines (182 loc) · 6.75 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Navigation Toggle
const navToggle = document.querySelector('.nav-toggle');
const navMenu = document.querySelector('.nav-menu');
if (navToggle) {
navToggle.addEventListener('click', () => {
navMenu.classList.toggle('active');
});
}
// Close mobile menu when clicking on a link
const navLinks = document.querySelectorAll('.nav-menu a');
navLinks.forEach(link => {
link.addEventListener('click', () => {
navMenu.classList.remove('active');
});
});
// Smooth scroll for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
const offsetTop = target.offsetTop - 80;
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
});
});
// Navbar scroll effect
let lastScroll = 0;
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
const currentScroll = window.pageYOffset;
if (currentScroll > 100) {
navbar.style.boxShadow = '0 4px 6px -1px rgba(0, 0, 0, 0.1)';
} else {
navbar.style.boxShadow = '0 1px 2px 0 rgba(0, 0, 0, 0.05)';
}
lastScroll = currentScroll;
});
// Intersection Observer for fade-in animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Observe all cards and sections
document.addEventListener('DOMContentLoaded', () => {
const animatedElements = document.querySelectorAll(
'.problem-card, .feature-card, .market-card, .solution-content, .tech-content, .contact-content'
);
animatedElements.forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(30px)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(el);
});
});
// Form submission handler
const contactForm = document.getElementById('contactForm');
if (contactForm) {
contactForm.addEventListener('submit', (e) => {
e.preventDefault();
// Get form data
const formData = new FormData(contactForm);
const data = Object.fromEntries(formData);
// Simulate form submission (in production, this would send to a server)
console.log('Form submitted:', data);
// Show success message
const submitButton = contactForm.querySelector('button[type="submit"]');
const originalText = submitButton.textContent;
submitButton.textContent = 'Message Sent!';
submitButton.style.background = 'linear-gradient(135deg, #10b981 0%, #059669 100%)';
submitButton.disabled = true;
// Reset form
contactForm.reset();
// Reset button after 3 seconds
setTimeout(() => {
submitButton.textContent = originalText;
submitButton.style.background = '';
submitButton.disabled = false;
}, 3000);
});
}
// Parallax effect for hero section
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const hero = document.querySelector('.hero');
if (hero) {
const heroContent = hero.querySelector('.hero-content');
if (heroContent && scrolled < window.innerHeight) {
heroContent.style.transform = `translateY(${scrolled * 0.5}px)`;
heroContent.style.opacity = 1 - (scrolled / window.innerHeight) * 0.5;
}
}
});
// Animate stats counter
const animateCounter = (element, target, duration = 2000) => {
let start = 0;
const increment = target / (duration / 16);
const updateCounter = () => {
start += increment;
if (start < target) {
element.textContent = Math.floor(start) + (element.textContent.includes('%') ? '%' : '');
requestAnimationFrame(updateCounter);
} else {
element.textContent = target + (element.textContent.includes('%') ? '%' : '');
}
};
updateCounter();
};
// Observe stats section and animate counters
const statsObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const statNumbers = entry.target.querySelectorAll('.stat-number');
statNumbers.forEach(stat => {
const text = stat.textContent;
const number = parseInt(text.replace(/\D/g, ''));
if (number && !stat.classList.contains('animated')) {
stat.classList.add('animated');
animateCounter(stat, number, 2000);
}
});
statsObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
const heroStats = document.querySelector('.hero-stats');
if (heroStats) {
statsObserver.observe(heroStats);
}
// Add active state to navigation links based on scroll position
const sections = document.querySelectorAll('section[id]');
window.addEventListener('scroll', () => {
let current = '';
const scrollY = window.pageYOffset;
sections.forEach(section => {
const sectionTop = section.offsetTop - 100;
const sectionHeight = section.offsetHeight;
if (scrollY >= sectionTop && scrollY < sectionTop + sectionHeight) {
current = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${current}`) {
link.classList.add('active');
}
});
});
// Device mockup animation
const deviceScreen = document.querySelector('.device-screen');
if (deviceScreen) {
setInterval(() => {
const dataPoints = deviceScreen.querySelectorAll('.data-point');
dataPoints.forEach((point, index) => {
setTimeout(() => {
const randomWidth = Math.floor(Math.random() * 30) + 60;
point.style.width = `${randomWidth}%`;
}, index * 200);
});
}, 3000);
}
// Add hover effect to cards
const cards = document.querySelectorAll('.problem-card, .feature-card, .market-card');
cards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transition = 'all 0.3s ease';
});
});
// Console message
console.log('%c⚡ Neuron by OmniSense', 'font-size: 20px; font-weight: bold; color: #6366f1;');
console.log('%cIntelligence Everywhere', 'font-size: 14px; color: #6b7280;');