forked from p4rz1v4l26/web-page-for-music-artists
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
188 lines (171 loc) · 5.61 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="./src/assets/logo192.png" />
<title>Moosic Stars</title>
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<link rel="stylesheet" href="./src/styles.css" />
</head>
<body>
<nav>
<div class="logo"><p>Moosic Stars</p></div>
</nav>
<div class="container">
<div class="overlay">
<div class="t-1 marquee-wrapper">
<h1>Post Malone Post Malone Post Malone</h1>
</div>
<div class="t-2 marquee-wrapper">
<h1>DJ Khaled DJ Khaled DJ Khaled DJ Khaled</h1>
</div>
<div class="t-3 marquee-wrapper">
<h1>Avicii Avicii Avicii Avicii Avicii Avicii Avicii Avicii</h1>
</div>
<div class="t-4 marquee-wrapper">
<h1>Ed Sheeran Ed Sheeran ED Sheeran Ed Sheeran</h1>
</div>
</div>
<div class="modal">
<div class="modal-images">
<a href="./src/postmalone.html" target="_blank">
<div class="img" id="t-1">
<img
src="./src/assets/postmalone/images/PostMalone_.jpg"
alt=""
/></div
></a>
<a href="./src/Khaled.html" target="_blank">
<div class="img" id="t-2">
<img src="./src/assets/Khaled/images/Khaled_.jpg" alt="" /></div
></a>
<a href="./src/Avicii.html" target="_blank">
<div class="img" id="t-3">
<img src="./src/assets/Avicii/images/Aviicii__.jpg" alt="" /></div
></a>
<a href="./src/EdSheeran.html" target="_blank">
<div class="img" id="t-4">
<img
src="./src/assets/EdSheeran/images/EdSheeran__.jpg"
alt=""
/></div
></a>
</div>
<div class="info">
<p class="name">Post Malone</p>
<p class="role">Hip Hop, Pop, R&B, and Trap</p>
</div>
</div>
</div>
<div class="cursor">
<i class="ph-light ph-arrow-left"></i>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/gsap.min.js"></script>
<script>
const team = [
{
name: "Post Malone",
role: "Hip Hop, Pop, R&B, and Trap",
},
{
name: "DJ Khaled",
role: "DJ, Record Executive, Record Producer, and Rapper",
},
{
name: "Avicii",
role: "DJ, producer, and songwriter",
},
{
name: "Ed Sheeran",
role: "Pop, Hip Hop, R & B",
},
];
const cursor = document.querySelector(".cursor");
const cursorIcon = cursor.querySelector("i");
const cursorWidth = cursor.offsetWidth / 2;
const cursorHeight = cursor.offsetHeight / 2;
let currentSlide = 1;
const totalSlides = 4;
const updateCursorClass = (xPosition) => {
const thirdPageWidth = window.innerWidth / 3;
if (xPosition > thirdPageWidth * 2) {
if (currentSlide < totalSlides) {
cursorIcon.classList.remove("ph-arrow-left");
cursorIcon.classList.add("ph-arrow-right");
cursor.style.display = "";
} else {
cursor.style.display = "none";
}
} else if (xPosition < thirdPageWidth) {
if (currentSlide > 1) {
cursorIcon.classList.remove("ph-arrow-right");
cursorIcon.classList.add("ph-arrow-left");
cursor.style.display = "";
} else {
cursor.style.display = "none";
}
} else {
cursor.style.display = "none";
}
};
document.addEventListener("mousemove", (e) => {
gsap.to(cursor, {
x: e.clientX - cursorWidth,
y: e.clientY - cursorHeight,
duration: 1,
ease: "power3.out",
});
updateCursorClass(e.clientX);
});
const updateInfo = (slideNumber) => {
const member = team[slideNumber - 1];
document.querySelector(".info .name").textContent = member.name;
document.querySelector(".info .role").textContent = member.role;
};
const animateSlide = (slideNumber, reveal) => {
const marquee = document.querySelector(
`.t-${slideNumber}.marquee-wrapper`
);
const img = document.getElementById(`t-${slideNumber}`);
const clipPathValue = reveal
? "polygon(0% 100%, 100% 100%, 100% 0%, 0% 0%)"
: "polygon(0% 100%, 100% 100%, 100% 100%, 0% 100%)";
gsap.to(marquee, {
clipPath: clipPathValue,
duration: 1,
ease: "power6.out",
delay: 0.2,
});
gsap.to(img, {
clipPath: clipPathValue,
duration: 1,
ease: "power4.out",
});
};
updateInfo(currentSlide);
const handleRightClick = () => {
if (currentSlide < totalSlides) {
animateSlide(currentSlide + 1, true);
currentSlide++;
updateInfo(currentSlide);
}
};
const handleLeftClick = () => {
if (currentSlide > 1) {
animateSlide(currentSlide, false);
currentSlide--;
updateInfo(currentSlide);
}
};
document.addEventListener("click", (e) => {
const thirdPageWidth = window.innerWidth / 3;
if (e.clientX > thirdPageWidth * 2) {
handleRightClick();
} else if (e.clientX < thirdPageWidth) {
handleLeftClick();
}
});
</script>
</body>
</html>