-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
154 lines (131 loc) · 3.66 KB
/
Copy pathindex.html
File metadata and controls
154 lines (131 loc) · 3.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Liquid Drain/pour kind off</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<style>
body {
background-color: #000;
color: #fff;
overflow-x: hidden;
}
.scroll-container {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.text-item {
position: relative;
font-size: clamp(3rem, 10vw, 8rem);
font-weight: 900;
line-height: 1;
text-transform: uppercase;
cursor: default;
margin: 0.2em 0;
}
.text-empty {
color: transparent;
-webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
}
.text-filled {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
color: #fff;
clip-path: inset(0% 0% 100% 0%);
pointer-events: none;
}
.spacer {
height: 50vh;
}
::selection {
background: #fff;
color: #000;
}
</style>
</head>
<body>
<div class="spacer flex items-end justify-center pb-10">
<p class="text-gray-400 animate-bounce text-sm tracking-widest uppercase">
Scroll to Pour
</p>
</div>
<section class="liquid-section w-full py-20 overflow-hidden">
<div class="scroll-container max-w-5xl mx-auto px-6">
<div class="text-item" data-index="0">
<span class="text-empty">Elegance</span>
<span class="text-filled">Elegance</span>
</div>
<div class="text-item" data-index="1">
<span class="text-empty">Precision</span>
<span class="text-filled">Precision</span>
</div>
<div class="text-item" data-index="2">
<span class="text-empty">Innovation</span>
<span class="text-filled">Innovation</span>
</div>
<div class="text-item" data-index="3">
<span class="text-empty">Performance</span>
<span class="text-filled">Performance</span>
</div>
<div class="text-item" data-index="4">
<span class="text-empty">Fluidity</span>
<span class="text-filled">Fluidity</span>
</div>
</div>
</section>
<div class="spacer flex items-start justify-center pt-20">
<p class="text-gray-500 uppercase tracking-widest text-sm">
Complete
</p>
</div>
<script>
gsap.registerPlugin(ScrollTrigger);
window.onload = () => {
const items = document.querySelectorAll(".text-item");
const filledTexts = document.querySelectorAll(".text-filled");
gsap.set(filledTexts[0], {
clipPath: "inset(0% 0% 0% 0%)"
});
const tl = gsap.timeline({
scrollTrigger: {
trigger: ".liquid-section",
start: "top top",
end: "+=400%",
pin: true,
scrub: 1,
markers: false
}
});
items.forEach((item, index) => {
if (index < items.length - 1) {
const currentFill = filledTexts[index];
const nextFill = filledTexts[index + 1];
tl.to(currentFill, {
clipPath: "inset(100% 0% 0% 0%)",
duration: 1,
ease: "none"
})
.to(
nextFill,
{
clipPath: "inset(0% 0% 0% 0%)",
duration: 1,
ease: "none"
},
"<"
);
}
});
};
</script>
</body>
</html>