Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
292 lines (264 loc) · 9.95 KB
/
Copy pathapp.js
File metadata and controls
292 lines (264 loc) · 9.95 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/**
* GUZ (ガズ) - Web Application Logic & Interactivity
*/
// Tracks & Audio Samples Configuration
const audioTracks = {
basic: {
title: "GUZ BASIC (Tom B2)",
artist: "Amostra Oficial • CVVV (Pop / J-Pop)",
src: "assets/sample_basic.ogg",
cover: "assets/guz_main.webp"
},
cute: {
title: "GUZ CUTE (Tom F#3)",
artist: "Amostra Oficial • CVVV (Kawaii / Fofo)",
src: "assets/sample_cute.ogg",
cover: "assets/guz_main.webp"
},
magical: {
title: "GUZ MAGICAL (Tom G3)",
artist: "Amostra Oficial • CVVC (Feitiço Pop)",
src: "assets/sample_magical.wav",
cover: "assets/guz_magical.webp"
}
};
const trackKeys = Object.keys(audioTracks);
let currentTrackKey = "basic";
const audioPlayer = new Audio();
audioPlayer.src = audioTracks[currentTrackKey].src;
// DOM Elements
const audioBar = document.getElementById("globalAudioBar");
const currentTrackTitle = document.getElementById("currentTrackTitle");
const currentTrackArtist = document.getElementById("currentTrackArtist");
const currentTrackCover = document.getElementById("currentTrackCover");
const audioTogglePlay = document.getElementById("audioTogglePlay");
const audioPlayIcon = document.getElementById("audioPlayIcon");
const audioPrev = document.getElementById("audioPrev");
const audioNext = document.getElementById("audioNext");
const currentTimeLabel = document.getElementById("currentTime");
const totalDurationLabel = document.getElementById("totalDuration");
const progressFill = document.getElementById("progressFill");
const progressBar = document.getElementById("progressBar");
const volumeSlider = document.getElementById("volumeSlider");
const heroPlayBtn = document.getElementById("heroPlayBtn");
// Designs Data
const designsData = {
basic: {
title: "GUZ BASIC — O Moletom Lilás do Cogumelo",
tag: "OUTFIT OFICIAL #1",
img: "assets/guz_main.webp",
biotipo: "Biotipo: Gordinho & Confortável",
text: "Blusa de moletom de mangas longas lilás com um grande cogumelo bege estampado e gola alta aconchegante. Acompanha bermuda marrom com uma faixa rosa-clara estampada com corações pendurada ao cós esquerdo, pingentes brilhantes de estrelas amarelas nas barras e polainas beges cobrindo dos joelhos aos calcanhares.",
features: [
"Moletom lilás com cogumelo estampado",
"Faixa rosa com estampa de corações no cós",
"Pingentes de estrela amarela reluzente",
"Polainas beges confortáveis nos tornozelos"
]
},
cute: {
title: "GUZ CUTE — O Nobre Idol de Wonderland",
tag: "OUTFIT OFICIAL #2",
img: "assets/guz_main.webp",
biotipo: "Biotipo: Esguio & Estatura Alta",
text: "Blusa branca de mangas longas e gola alta com cauda em formato de V e forro interno vermelho vibrante. Ombreiras detalhadas simulando manga fofa realçam sua postura graciosa. Acompanha calça flare com corações, faixa temática no cós, cartola icônica com laço rosa e bilhete '10/3', empunhando seu tripé-machado com coração!",
features: [
"Cartola nobre com laço rosa & bilhete 10/3",
"Blusa cauda em V com forro vermelho",
"Calça flare estilizada com corações",
"Microfone tripé com machado temático"
]
},
magical: {
title: "GUZ MAGICAL — O Feitiço Místico Pop",
tag: "OUTFIT OFICIAL #3",
img: "assets/guz_magical.webp",
biotipo: "Biotipo: Encantador & Mágico",
text: "Uma roupagem estelar repleta de tons arroxeados, pingentes mágicos e detalhes cintilantes inspirados na magia ancestral de Wonderland. Proporciona uma presença de palco única e imponente.",
features: [
"Traje com ressonância mística e brilho estelar",
"Configuração CVVC avançada (Rosaaah)",
"Projeção vocal encorpada com WORLDLINE-R",
"Pingente de lua crescente em destaque"
]
},
starlight: {
title: "GUZ STARLIGHT — A Sinfonia Galáctica",
tag: "OUTFIT OFICIAL #4",
img: "assets/guz_magical.webp",
biotipo: "Biotipo: Versátil & Multi-Color",
text: "A mais nova e completa versão vocal e estética do GUZ! Apresenta três paletas expressivas: o vocal Natural e firme, o Voice Color Soft (doce, sussurrado e aveludado) e o Voice Color Moe (ultra açucarado).",
features: [
"Vocal Natural + Cores Soft & Moe",
"Alcance tonal estendido de C2 a C5",
"Configurado com maestria por Gusta-P",
"Design cósmico cintilante"
]
}
};
// Play Specific Sample Function
function playSample(trackKey) {
if (audioTracks[trackKey]) {
currentTrackKey = trackKey;
const track = audioTracks[trackKey];
audioPlayer.src = track.src;
currentTrackTitle.textContent = track.title;
currentTrackArtist.textContent = track.artist;
currentTrackCover.src = track.cover;
audioPlayer.play().then(() => {
updatePlayButtonUI(true);
}).catch(err => {
console.warn("Autoplay prevention:", err);
});
}
}
// Update Play / Pause Icon
function updatePlayButtonUI(isPlaying) {
if (isPlaying) {
audioPlayIcon.classList.remove("fa-play");
audioPlayIcon.classList.add("fa-pause");
if (heroPlayBtn) heroPlayBtn.innerHTML = '<i class="fa-solid fa-pause"></i>';
} else {
audioPlayIcon.classList.remove("fa-pause");
audioPlayIcon.classList.add("fa-play");
if (heroPlayBtn) heroPlayBtn.innerHTML = '<i class="fa-solid fa-play"></i>';
}
}
// Toggle Play/Pause
audioTogglePlay.addEventListener("click", () => {
if (audioPlayer.paused) {
audioPlayer.play();
updatePlayButtonUI(true);
} else {
audioPlayer.pause();
updatePlayButtonUI(false);
}
});
if (heroPlayBtn) {
heroPlayBtn.addEventListener("click", () => {
if (audioPlayer.paused) {
playSample("basic");
} else {
audioPlayer.pause();
updatePlayButtonUI(false);
}
});
}
// Previous & Next Track
audioPrev.addEventListener("click", () => {
let currentIndex = trackKeys.indexOf(currentTrackKey);
currentIndex = (currentIndex - 1 + trackKeys.length) % trackKeys.length;
playSample(trackKeys[currentIndex]);
});
audioNext.addEventListener("click", () => {
let currentIndex = trackKeys.indexOf(currentTrackKey);
currentIndex = (currentIndex + 1) % trackKeys.length;
playSample(trackKeys[currentIndex]);
});
// Update Progress Bar
audioPlayer.addEventListener("timeupdate", () => {
if (audioPlayer.duration) {
const current = audioPlayer.currentTime;
const duration = audioPlayer.duration;
const pct = (current / duration) * 100;
progressFill.style.width = `${pct}%`;
currentTimeLabel.textContent = formatTime(current);
totalDurationLabel.textContent = formatTime(duration);
}
});
audioPlayer.addEventListener("ended", () => {
updatePlayButtonUI(false);
progressFill.style.width = "0%";
});
progressBar.addEventListener("click", (e) => {
const rect = progressBar.getBoundingClientRect();
const clickX = e.clientX - rect.left;
const width = rect.width;
if (audioPlayer.duration) {
audioPlayer.currentTime = (clickX / width) * audioPlayer.duration;
}
});
// Volume Slider
volumeSlider.addEventListener("input", (e) => {
audioPlayer.volume = e.target.value;
});
// Format Time in mm:ss
function formatTime(secs) {
const m = Math.floor(secs / 60);
const s = Math.floor(secs % 60);
return `${m}:${s < 10 ? '0' : ''}${s}`;
}
// Open YouTube Video Helper
function openYouTube(videoId) {
window.open(`https://www.youtube.com/watch?v=${videoId}`, '_blank');
}
// Design Tabs Switcher
const designTabs = document.querySelectorAll(".design-tab");
const designTitle = document.getElementById("designTitle");
const designTag = document.getElementById("designTag");
const designText = document.getElementById("designText");
const designDetailImg = document.getElementById("designDetailImg");
const designBiotipo = document.getElementById("designBiotipo");
const designFeatures = document.getElementById("designFeatures");
designTabs.forEach(tab => {
tab.addEventListener("click", () => {
designTabs.forEach(t => t.classList.remove("active"));
tab.classList.add("active");
const dKey = tab.getAttribute("data-design");
const data = designsData[dKey];
if (data) {
designTitle.textContent = data.title;
designTag.textContent = data.tag;
designText.textContent = data.text;
designDetailImg.src = data.img;
designBiotipo.textContent = data.biotipo;
// Animate Image
designDetailImg.style.opacity = '0';
designDetailImg.style.transform = 'scale(0.95)';
setTimeout(() => {
designDetailImg.style.opacity = '1';
designDetailImg.style.transform = 'scale(1)';
}, 150);
// Render features
designFeatures.innerHTML = data.features.map(f => `
<div class="feature-item">
<i class="fa-solid fa-circle-check"></i>
<span>${f}</span>
</div>
`).join('');
}
});
});
// Floating Particle Generator (Coffee beans & sparkles)
function initParticles() {
const container = document.getElementById("particles");
const icons = ['☕', '✨', '♥', '★', '🎵', '🍰'];
const count = 22;
for (let i = 0; i < count; i++) {
const particle = document.createElement("div");
particle.className = "particle";
particle.textContent = icons[Math.floor(Math.random() * icons.length)];
particle.style.left = `${Math.random() * 100}vw`;
particle.style.animationDuration = `${8 + Math.random() * 10}s`;
particle.style.animationDelay = `${Math.random() * 5}s`;
particle.style.fontSize = `${12 + Math.random() * 16}px`;
container.appendChild(particle);
}
}
// Mobile Menu Toggle
const mobileToggle = document.getElementById("mobileToggle");
const navMenu = document.getElementById("navMenu");
if (mobileToggle) {
mobileToggle.addEventListener("click", () => {
navMenu.classList.toggle("open");
});
}
document.querySelectorAll(".nav-link").forEach(link => {
link.addEventListener("click", () => {
navMenu.classList.remove("open");
});
});
// Initialize on DOM load
document.addEventListener("DOMContentLoaded", () => {
initParticles();
});