-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
259 lines (226 loc) · 10.6 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scrolling animation website</title>
<!-- lens:CSS -->
<style>
html.lenis,
html.lenis body {
height: auto;
}
.lenis.lenis-smooth {
scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}
.lenis.lenis-stopped {
overflow: hidden;
}
.lenis.lenis-smooth iframe {
pointer-events: none;
}
</style>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div class=" w-full bg-zinc-900">
<div class="parent w-full h-[1400vh] relative">
<div class="h-screen w-full sticky top-0 left-0 overflow-x-hidden">
<canvas id="canvas" class=" w-full h-screen "></canvas>
<div class="absolute animate1 z-[2] text-white bottom-10 w-1/2 left-10">
<h1 class="leading-20 font-[100] text-3xl">
© 2024 DOZE STD
</h1>
<h1 class="text-3xl">SHAPING BRANDS -> CRAFTING MOTION</h1>
</div>
<div class="absolute flex animate2 z-[2] text-white text-right bottom-10 right-10 w-1/2 opacity-0">
<h1 class="leading-20 text-6xl font-[100] uppercase">Transforming Visions</h1>
<h1 class="text-xl w-1/2">Building identity and inspiring action.Sculpting digital experience
that resonate.</h1>
</div>
<div
class="absolute animate3 z-[2] text-white top-1/2 left-1/2 -translate-x-1/2 -tanslate-y-1/2 text-center opacity-0">
<h1 class="leading-20 font-[100] uppercase text-6xl">Elevating Aesthetics</h1>
<h1 class="text-xl">Crafting Solutions and exploring new horizons. Evolving narratives and elevating
aesthetics in every project.</h1>
</div>
<div class="panel w-1/3 translate-x-full h-screen absolute bg-white right-0 top-0 z-[2] p-10 ">
<h3 class="panelelem text-xl font-[100]">© 2024 DOZA.Std</h3>
<p class="panelelm text-xl mt-10">
Sculpting Digital
Transforming visions into digital realities. Waving stories that captive and innovate.
Exploring new possibilites with a focus on narrative evolution. Crafting solutions that engate
and elevate.
</p>
<button class="panelelem border-[1px] border-[#555] px-3 py-2 mt-6 font-[100]">Get Reviews</button>
<div class="panelelem absolute bottom-10">
<h3 class="text-xl">Innovating Design</h3>
<p class="mt-3 text-sm">
Connecting ideas to foster creativity. Designing impactful experiences that resonate.
Feel free to mix and match these sections to suit your website's desingn needs!
</p>
<button
class="bg-black text-white px-7 py-4 mt-4 text-sm font-[100] capitalize">experience</button>
</div>
</div>
<div
class="panelism absolute z-[2] text-white left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center text-6xl tracking-tighter opacity-0">
©Panelism <span class="line w-10 h-1 bg-white inline-block"></span>2048
</div>
</div>
</div>
<div class="bg-white py-32 px-10 w-full">
<h1 class="text-8xl tracking-tighter">® Our Recent Works.</h1>
<div class="headings w-1/2 flex flex-col gap-10 mt-32">
<h3 class="text-7xl">Yuki Tanaka</h3>
<h3 class="text-7xl">Hiroshi Yamamoto</h3>
<h3 class="text-7xl">Akira Sato</h3>
<h3 class="text-7xl">Naoko Suzuki</h3>
<h3 class="text-7xl">Kenji Nakamura</h3>
<h3 class="text-7xl">Yumi Kobayashi</h3>
<h3 class="text-7xl">Takashi Kato</h3>
<h3 class="text-7xl">Rina Yamada</h3>
<h3 class="text-7xl">Shinji Ito</h3>
<h3 class="text-7xl">Emi Watanabe</h3>
</div>
</div>
</div>
<!-- gsap:for scroll trigger -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"
integrity="sha512-7eHRwcbYkK4d9g/6tD/mhkf++eoTHwpNM9woBxtPUBWm67zeAfFC+HrdoE2GanKeocly/VxeLvIqwvCdk7qScg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"
integrity="sha512-onMTRKJBKz8M1TnqqDuGBlowlH0ohFzMXYRNebz+yOcc5TQr/zAKsthzhuv0hiyUKEiQEQXEynnXCvNTOk50dg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!--lenis for smooth scrolling -->
<script src="https://unpkg.com/lenis@1.1.11/dist/lenis.min.js"></script>
<script>
const canvas = document.querySelector("#canvas");
const contex = canvas.getContext("2d");//context used to draw anything on canvas:
const frames = {
cureentIndex: 0,
maxIndex: 538
}
const images = [];//store all the images:
let imageLoaded = 0;
//to preLoadImages:
const preLoadImages = () => {
for (var i = 1; i <= frames.maxIndex; i++) {
let imgUrl = `./frames/frame_${i.toString().padStart(4, '0')}.jpeg`
let img = new Image();
img.src = imgUrl;
img.onload = () => {
imageLoaded++;
// console.log(imageLoaded)
if (imageLoaded === frames.maxIndex) {
console.log("All images loaded")
loadImage(frames.cureentIndex);
startAnimation();
}
}
images.push(img);
}
}
//to loadImag:
const loadImage = (index) => {
const img = images[index];
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const scaleX = canvas.width / img.width;
const scaleY = canvas.height / img.height;
const scale = Math.max(scaleX, scaleY);
const newWidth = img.width * scale;
const newHeight = img.height * scale;
const offsetX = (canvas.width - newWidth) / 2;
const offsetY = (canvas.height - newHeight) / 2;
contex.clearRect(0, 0, canvas.width, canvas.height);
contex.imageSmoothingEnabled = true;
contex.imageSmoothingQuality = "high";
contex.drawImage(img, offsetX, offsetY, newWidth, newHeight)
frames.cureentIndex = index;
}
//to add animation:
const startAnimation = () => {
var tl = gsap.timeline({
scrollTrigger: {
trigger: '.parent',
start: 'top top',
scrub: 2,
end: 'bottom bottom'
}
})
const updateFrame = (index) => {
return {
cureentIndex: index,
ease: 'linear',
onUpdate: () => {
loadImage(Math.floor(frames.cureentIndex));
}
}
}
tl
.to(frames, updateFrame(50), "first")
.to(".animate1", { opacity: 0, ease: "linear" }, "first")
.to(frames, updateFrame(80), "second")
.to(".animate2", { opacity: 1, ease: "linear" }, "second")
.to(frames, updateFrame(110), "third")
.to(".animate2", { opacity: 1, ease: "linear" }, "third")
.to(frames, updateFrame(140), "fourth")
.to(".animate2", { opacity: 0, ease: "linear" }, "fourth")
.to(frames, updateFrame(170), "fifth")
.to(".animate3", { opacity: 1, ease: "linear" }, "fifth")
.to(frames, updateFrame(200), "sixth")
.to(".animate3", { opacity: 1, ease: "linear" }, "sixth")
.to(frames, updateFrame(230), "seventh")
.to(".animate3", { opacity: 0, ease: "linear" }, "seventh")
.to(frames, updateFrame(260), "eighth")
.to(".panel", { x: "0%", ease: "expo" }, "eighth")
.to(frames, updateFrame(290), "ninth")
.to(".panel", { x: "0%", ease: "linear" }, "ninth")
.to(frames, updateFrame(320), "tenth")
.to(".panel", { opacity: 0, ease: "linear" }, "tenth")
.to(frames, updateFrame(350), "eleventh")
.to("canvas", { scale: .5, ease: "linear" }, "eleventh")
.to(frames, updateFrame(380), "twelvth")
.to(".panelism", { opacity: 1, ease: "expo" }, "twelvth")
.to(frames, updateFrame(410), "twelvth")
.to(".panelism span", { width: 200, ease: "expo" }, "twelvth")
.to(frames, updateFrame(440), "thirteen")
.to("canvas", { scale: 1, ease: "linear" }, "thirteen")
.to(frames, updateFrame(480), "fourteen")
.to(".panelism", { scale: 2, ease: "circ" }, "fourteen")
.to(frames, updateFrame(537), "fifteen")
.to(".panelism", { scale: 2, ease: "circ" }, "fifteen")
}
//calling the preLoadImages function:
preLoadImages();
//to handle resize of window:
window.addEventListener('resize', () => {
loadImage(Math.floor(frames.cureentIndex));
});
// fade effect on heading using gsap-trigger:
document.querySelectorAll(".headings h3")
.forEach((elem) => {
gsap.from(elem, {
scrollTrigger: {
trigger: elem,
start: 'top 90%',
end: 'bottom 20%',
scrub: 2
},
opacity: .3
})
})
// Lenis:CODE
const lenis = new Lenis()
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
</script>
</body>
</html>