-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
227 lines (202 loc) ยท 7.81 KB
/
Copy pathapp.js
File metadata and controls
227 lines (202 loc) ยท 7.81 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
// ============================================================
// MOTUS MAGIC SYSTEM โ Claris AI Cybersecurity Grimoire
// Interactive JS โ particles, filters, reality check, scroll fx
// ============================================================
// โโ Particle System โโ
(function initParticles() {
const container = document.getElementById('particles');
if (!container) return;
const colors = [
'rgba(184,41,255,',
'rgba(0,255,204,',
'rgba(255,215,0,',
'rgba(255,107,53,',
'rgba(255,255,255,'
];
function createParticle() {
const p = document.createElement('div');
p.className = 'particle';
const color = colors[Math.floor(Math.random() * colors.length)];
const size = Math.random() * 3 + 1;
const duration = Math.random() * 12 + 8;
const delay = Math.random() * 8;
const startX = Math.random() * 100;
const drift = (Math.random() - 0.5) * 200;
const opacity = Math.random() * 0.5 + 0.2;
p.style.cssText = `
left: ${startX}%;
width: ${size}px;
height: ${size}px;
background: ${color}${opacity});
box-shadow: 0 0 ${size * 2}px ${color}0.8);
animation-duration: ${duration}s;
animation-delay: ${delay}s;
--drift: ${drift}px;
`;
container.appendChild(p);
setTimeout(() => p.remove(), (duration + delay) * 1000);
}
// Create initial batch
for (let i = 0; i < 25; i++) createParticle();
setInterval(createParticle, 600);
})();
// โโ Nav scroll effect โโ
(function initNav() {
const nav = document.getElementById('nav');
window.addEventListener('scroll', () => {
nav.classList.toggle('scrolled', window.scrollY > 60);
}, { passive: true });
})();
// โโ Fade-in on scroll (Intersection Observer) โโ
(function initScrollFade() {
const cards = document.querySelectorAll('.spell-card, .school-card, .ability-card, .reality-tier, .school-grimoire-section');
if (!('IntersectionObserver' in window)) {
cards.forEach(c => c.classList.add('visible'));
return;
}
const obs = new IntersectionObserver((entries) => {
entries.forEach(e => {
if (e.isIntersecting) {
e.target.classList.add('fade-in', 'visible');
obs.unobserve(e.target);
}
});
}, { rootMargin: '0px 0px -60px 0px', threshold: 0.1 });
cards.forEach(c => {
c.classList.add('fade-in');
obs.observe(c);
});
})();
// โโ Grimoire Filter System โโ
(function initFilters() {
const filterBtns = document.querySelectorAll('.filter-btn');
const spellCards = document.querySelectorAll('.spell-card');
const schoolSections = document.querySelectorAll('.school-grimoire-section');
let activeSchool = 'all';
let activeBuild = null;
function applyFilters() {
spellCards.forEach(card => {
const school = card.dataset.school;
const build = card.dataset.build;
const schoolMatch = activeSchool === 'all' || school === activeSchool;
const buildMatch = !activeBuild || build === activeBuild;
if (schoolMatch && buildMatch) {
card.classList.remove('hidden');
} else {
card.classList.add('hidden');
}
});
// Hide empty school sections
schoolSections.forEach(section => {
const visibleCards = section.querySelectorAll('.spell-card:not(.hidden)');
section.style.display = visibleCards.length > 0 ? '' : 'none';
});
}
filterBtns.forEach(btn => {
btn.addEventListener('click', () => {
const filter = btn.dataset.filter;
if (['all', 'lux', 'dark', 'motus'].includes(filter)) {
// School filter
document.querySelectorAll('.filter-btn[data-filter="all"], .filter-btn[data-filter="lux"], .filter-btn[data-filter="dark"], .filter-btn[data-filter="motus"]')
.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
activeSchool = filter;
} else {
// Build filter โ toggle
if (activeBuild === filter) {
activeBuild = null;
btn.classList.remove('active');
} else {
document.querySelectorAll('.filter-btn[data-filter="built"], .filter-btn[data-filter="buildable"], .filter-btn[data-filter="emerging"]')
.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
activeBuild = filter;
}
}
applyFilters();
});
});
})();
// โโ Reality Check โ Populate Spell Lists โโ
(function initRealityCheck() {
const spells = {
built: [
{ name: 'Ward of the Perimeter', school: 'lux' },
{ name: 'Shield of Zero Trust', school: 'lux' },
{ name: 'Sanctum Seal', school: 'lux' },
{ name: 'Veil of Transit', school: 'lux' },
{ name: 'Beacon of Anomaly', school: 'lux' },
{ name: 'Restoration Rite', school: 'lux' },
{ name: 'Circle of Least Privilege', school: 'lux' },
{ name: 'Mirror of Deception', school: 'lux' },
{ name: 'Glyph of Authentication', school: 'lux' },
{ name: 'Aura of Compliance', school: 'lux' },
{ name: 'Chrono Seal', school: 'lux' },
{ name: 'Purification Rite', school: 'lux' },
{ name: 'Shadow Walk', school: 'dark' },
{ name: 'Curse Reversal', school: 'dark' },
{ name: 'Void Gaze', school: 'dark' },
{ name: 'Soul Bind', school: 'dark' },
{ name: 'Poison Oracle', school: 'dark' },
{ name: 'Eclipse Protocol', school: 'dark' },
{ name: 'Blood Pact Audit', school: 'dark' },
{ name: 'Obsidian Eye', school: 'dark' },
{ name: 'Flow State', school: 'motus' },
{ name: 'Pattern Weave', school: 'motus' },
],
buildable: [
{ name: 'Whisper Net', school: 'lux' },
{ name: 'Hex Trace', school: 'dark' },
{ name: 'Phantom Hunt', school: 'dark' },
{ name: 'Necromancy of Dead Process', school: 'dark' },
{ name: 'Serpent\'s Tongue', school: 'dark' },
{ name: 'Wraith Trap', school: 'dark' },
{ name: 'Shift of Shape', school: 'motus' },
{ name: 'Temporal Sight', school: 'motus' },
{ name: 'Cascade Break', school: 'motus' },
{ name: 'Evolution Sigil', school: 'motus' },
{ name: 'Resonance Lock', school: 'motus' },
{ name: 'Chaos Communion', school: 'motus' },
{ name: 'Living Grimoire', school: 'motus' },
{ name: 'Outlier Sense', school: 'motus' },
],
emerging: [
{ name: 'Emergence Ward', school: 'motus' },
{ name: 'Fractal Shield', school: 'motus' },
{ name: 'Mycelium Network', school: 'motus' },
],
};
function renderList(containerId, countId, items) {
const container = document.getElementById(containerId);
const countEl = document.getElementById(countId);
if (!container) return;
countEl && (countEl.textContent = `${items.length} Spells`);
items.forEach(({ name, school }) => {
const div = document.createElement('div');
div.className = 'tier-spell-item';
div.innerHTML = `
<span>${name}</span>
<span class="spell-school-dot ${school}-dot" title="${school.charAt(0).toUpperCase() + school.slice(1)}"></span>
`;
container.appendChild(div);
});
}
renderList('built-list', 'built-count', spells.built);
renderList('buildable-list', 'buildable-count', spells.buildable);
renderList('emerging-list', 'emerging-count', spells.emerging);
})();
// โโ Smooth anchor scroll with offset for fixed nav โโ
document.querySelectorAll('a[href^="#"]').forEach(link => {
link.addEventListener('click', e => {
const target = document.querySelector(link.getAttribute('href'));
if (!target) return;
e.preventDefault();
const offset = 80;
const top = target.getBoundingClientRect().top + window.scrollY - offset;
window.scrollTo({ top, behavior: 'smooth' });
});
});
// โโ Rune stagger animation โโ
document.querySelectorAll('.hero-rune').forEach((rune, i) => {
rune.style.animationDelay = `${i * -4}s`;
});