-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
173 lines (145 loc) · 6.19 KB
/
Copy pathscript.js
File metadata and controls
173 lines (145 loc) · 6.19 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
// Rolagem suave (Lenis) — declarado primeiro
const lenis = new Lenis({
duration: 2.0,
easing: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)),
smooth: false,
smoothTouch: false,
});
function raf(time) { lenis.raf(time); requestAnimationFrame(raf); }
requestAnimationFrame(raf);
function lockScroll() { lenis.stop(); }
function unlockScroll() { lenis.start(); }
// Typewriter
const app = document.getElementById("app");
const typewriter = new Typewriter(app, { loop: true, delay: 90 });
typewriter
.typeString(`<span style="-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);background-color:rgba(255,255,255,.15);border-radius:.375rem;">Transformando Pele em Arte.</span>`)
.pauseFor(2000)
.deleteAll()
.typeString(`<span style="-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);background-color:rgba(255,255,255,.15);border-radius:.375rem;">Borges Tattoo!</span>`)
.pauseFor(1000)
.start();
// Partículas
document.addEventListener("DOMContentLoaded", function () {
particlesJS("particles-js", {
particles: {
number: { value: 50, density: { enable: false, value_area: 800 } },
color: { value: "#ffffff" },
shape: { type: "circle", stroke: { width: 0, color: "#000000" } },
opacity: { value: 0.5, random: false, anim: { enable: false } },
size: { value: 3, random: true, anim: { enable: false } },
line_linked: { enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1 },
move: { enable: true, speed: 2, direction: "none", random: false, straight: false, out_mode: "out" },
},
interactivity: {
detect_on: "canvas",
events: {
onhover: { enable: true, mode: "grab" },
onclick: { enable: true, mode: "push" },
},
modes: {
grab: { distance: 140, line_linked: { opacity: 1 } },
push: { particles_nb: 4 },
},
},
retina_detect: true,
});
});
// Carrossel do Portfólio
const cards = document.querySelector(".cards");
const wrapper = document.querySelector(".cards-wrapper");
const nextBtn = document.querySelector(".next");
const prevBtn = document.querySelector(".prev");
let currentIndex = 0;
function updateCarousel(direction) {
const card = cards.querySelector("img");
const cardWidth = card.offsetWidth + 16;
const visibleCount = Math.floor(wrapper.offsetWidth / cardWidth);
const maxIndex = cards.children.length - visibleCount;
if (direction === "next" && currentIndex < maxIndex) currentIndex++;
if (direction === "prev" && currentIndex > 0) currentIndex--;
cards.style.transform = `translateX(-${currentIndex * cardWidth}px)`;
}
nextBtn.addEventListener("click", () => updateCarousel("next"));
prevBtn.addEventListener("click", () => updateCarousel("prev"));
// Lightbox de imagem
const lightbox = document.getElementById("lightbox");
const lightboxImg = document.getElementById("lightbox-img");
const lightboxWrapper = document.getElementById("lightbox-img-wrapper");
const lightboxClose = document.getElementById("lightbox-close");
document.querySelectorAll(".cards img").forEach(img => {
img.style.cursor = "pointer";
img.addEventListener("click", () => {
lightboxImg.src = img.src;
lightboxImg.alt = img.alt;
lightboxImg.classList.remove("zoomed");
lightboxWrapper.classList.remove("zoomed");
lightbox.classList.add("active");
lockScroll();
});
});
function closeLightbox() {
lightbox.classList.remove("active");
unlockScroll();
}
lightboxClose.addEventListener("click", closeLightbox);
lightbox.addEventListener("click", e => { if (e.target === lightbox) closeLightbox(); });
lightboxWrapper.addEventListener("click", () => {
lightboxImg.classList.toggle("zoomed");
lightboxWrapper.classList.toggle("zoomed");
});
// Carrossel da Equipe
const teamTrack = document.querySelector(".team-track");
const teamDots = document.querySelectorAll(".team-dot");
let teamIndex = 0;
function goToMember(index) {
teamIndex = index;
teamTrack.style.transform = `translateX(-${teamIndex * 100}%)`;
teamDots.forEach((d, i) => d.classList.toggle("active", i === teamIndex));
}
let teamAutoplay = setInterval(() => goToMember((teamIndex + 1) % teamDots.length), 5000);
function resetTeamAutoplay() {
clearInterval(teamAutoplay);
teamAutoplay = setInterval(() => goToMember((teamIndex + 1) % teamDots.length), 5000);
}
document.querySelector(".team-next").addEventListener("click", () => { goToMember((teamIndex + 1) % teamDots.length); resetTeamAutoplay(); });
document.querySelector(".team-prev").addEventListener("click", () => { goToMember((teamIndex - 1 + teamDots.length) % teamDots.length); resetTeamAutoplay(); });
teamDots.forEach((dot, i) => dot.addEventListener("click", () => { goToMember(i); resetTeamAutoplay(); }));
// Lightbox de vídeo
const videoLightbox = document.getElementById("video-lightbox");
const videoLightboxPlayer = document.getElementById("video-lightbox-player");
const videoLightboxClose = document.getElementById("video-lightbox-close");
document.getElementById("about-video-thumb").addEventListener("click", () => {
videoLightbox.classList.add("active");
videoLightboxPlayer.play();
lockScroll();
});
function closeVideoLightbox() {
videoLightbox.classList.remove("active");
videoLightboxPlayer.pause();
unlockScroll();
}
videoLightboxClose.addEventListener("click", closeVideoLightbox);
videoLightbox.addEventListener("click", e => { if (e.target === videoLightbox) closeVideoLightbox(); });
document.addEventListener("keydown", e => {
if (e.key === "Escape") { closeLightbox(); closeVideoLightbox(); }
});
// Menu hamburguer mobile
const menuToggle = document.querySelector(".menu-toggle");
const nav = document.querySelector("header > nav");
menuToggle.addEventListener("click", () => {
const isOpen = nav.classList.toggle("open");
menuToggle.classList.toggle("open", isOpen);
document.body.classList.toggle("nav-open", isOpen);
menuToggle.setAttribute("aria-expanded", isOpen);
isOpen ? lockScroll() : unlockScroll();
});
nav.querySelectorAll("a").forEach(link => {
link.addEventListener("click", () => {
nav.classList.remove("open");
menuToggle.classList.remove("open");
document.body.classList.remove("nav-open");
menuToggle.setAttribute("aria-expanded", false);
unlockScroll();
});
});