Skip to content

Commit 70c7bde

Browse files
committedApr 6, 2024·
アニメーションの追加
1 parent a2790c8 commit 70c7bde

File tree

2 files changed

+85
-26
lines changed

2 files changed

+85
-26
lines changed
 

‎src/components/SectionTitle.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
<script setup lang="ts"></script>
2+
13
<template>
24
<div class="flex justify-center">
35
<h1
6+
:id="$attrs.props.id ?? ''"
47
class="inline-block text-4xl leading-[4rem] border-b border-main text-main"
58
:style="{ fontFamily: 'Jost, sans-serif' }"
69
>
7-
{{ $attrs.value }}
10+
{{ $attrs.props.value ?? '' }}
811
</h1>
912
</div>
1013
</template>

‎src/pages/index.vue

+81-25
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,77 @@ const blogListData = await fetchBlogList();
77
88
const { $gsap } = useNuxtApp();
99
10+
const scrollTrigger = (target: string, start: string) => {
11+
return { trigger: target, start: start };
12+
};
13+
14+
const firstViewAnimation = () => {
15+
const baseOptions = {
16+
opacity: 0,
17+
duration: 1,
18+
};
19+
$gsap.from('.fv-bg', {
20+
delay: 0.5,
21+
ease: 'power1.out',
22+
...baseOptions,
23+
});
24+
$gsap.from('.fv-logo', {
25+
delay: 1.5,
26+
ease: 'power1.out',
27+
...baseOptions,
28+
});
29+
$gsap.from('.fv-border', {
30+
delay: 2.5,
31+
ease: 'power1.out',
32+
...baseOptions,
33+
});
34+
};
35+
36+
const titleAnimation = (target: string) => {
37+
$gsap.from(target, {
38+
scrollTrigger: scrollTrigger(target, 'center bottom'),
39+
opacity: 0,
40+
y: '10px',
41+
duration: 1,
42+
delay: 0.5,
43+
});
44+
};
45+
1046
const conceptAnimation = (target: string, x: string, duration: number) => {
1147
$gsap.from(target, {
12-
scrollTrigger: {
13-
trigger: target,
14-
start: 'top center',
15-
},
48+
scrollTrigger: scrollTrigger(target, 'top bottom'),
1649
opacity: 0,
1750
x: x,
1851
duration: duration,
52+
delay: 0.5,
1953
});
2054
};
2155
2256
const galleryAnimation = (target: string, y: string, duration: number) => {
2357
$gsap.from(target, {
24-
scrollTrigger: {
25-
trigger: target,
26-
start: 'top bottom',
27-
},
58+
scrollTrigger: scrollTrigger(target, 'top bottom'),
2859
opacity: 0,
2960
y: y,
3061
duration: duration,
62+
delay: 0.5,
63+
stagger: 0.1,
64+
});
65+
};
66+
67+
const menuAnimation = (target: string) => {
68+
$gsap.from(target, {
69+
scrollTrigger: scrollTrigger(target, 'top bottom'),
70+
opacity: 0,
71+
y: '10px',
72+
duration: 1,
73+
delay: 0.5,
3174
stagger: 0.1,
3275
});
3376
};
3477
3578
const stylistAnimation = (target: string, x: string) => {
3679
$gsap.from(target, {
37-
scrollTrigger: {
38-
trigger: target,
39-
start: 'top bottom',
40-
},
80+
scrollTrigger: scrollTrigger(target, 'top bottom'),
4181
opacity: 0,
4282
x: x,
4383
duration: 1,
@@ -46,12 +86,19 @@ const stylistAnimation = (target: string, x: string) => {
4686
4787
// animation
4888
onMounted(() => {
89+
// first view
90+
firstViewAnimation();
91+
// title
92+
titleAnimation('#blogTitle');
93+
// concept
4994
conceptAnimation('#concept1img', '-50px', 1);
5095
conceptAnimation('#concept1text', '50px', 1);
5196
conceptAnimation('#concept2img', '50px', 1);
5297
conceptAnimation('#concept2text', '-50px', 1);
53-
98+
// gallery
5499
galleryAnimation('.gallery-card', '-10px', 1);
100+
// menu
101+
menuAnimation('.menu-card');
55102
56103
stylistAnimation('#stylistImg', '-50px');
57104
stylistAnimation('#stylistText', '50px');
@@ -77,10 +124,13 @@ const styles = {
77124

78125
<template>
79126
<div
80-
:class="`flex justify-center items-center relative w-full h-[750px] ${styles.background}`"
127+
:class="`fv-bg flex justify-center items-center relative w-full h-[750px] ${styles.background}`"
81128
>
82-
<img class="absolute w-[98%] h-[98%]" src="/images/mv-border.svg" />
83-
<img class="title absolute w-[520px]" src="/images/logo-lg.png" />
129+
<img
130+
class="fv-border absolute w-[98%] h-[98%]"
131+
src="/images/mv-border.svg"
132+
/>
133+
<img class="fv-logo title absolute w-[520px]" src="/images/logo-lg.png" />
84134
</div>
85135
<!--catchcopy-->
86136
<div class="flex justify-center w-full bg-[#DDD3C3]">
@@ -97,7 +147,7 @@ const styles = {
97147
</div>
98148
<!--blog-->
99149
<div id="blog" class="py-10">
100-
<SectionTitle value="Blog" />
150+
<SectionTitle :props="{ id: 'blogTitle', value: 'Blog' }" />
101151
<div class="w-[250px] py-6 mx-auto">
102152
<a :href="`/post/${blogListData?.contents[0]?.id ?? ''}`">
103153
<img
@@ -197,7 +247,7 @@ const styles = {
197247
</div>
198248
<!--gallery-->
199249
<div id="gallery" class="bg-[#F1EAE5] px-[10px] sm:px-[50px] py-[80px]">
200-
<SectionTitle value="Gallery" />
250+
<SectionTitle :props="{ id: 'galleryTitle', value: 'Gallery' }" />
201251
<div class="flex justify-center mt-[50px]">
202252
<div class="grid grid-cols-2 lg:grid-cols-4 gap-7">
203253
<div
@@ -217,22 +267,25 @@ const styles = {
217267
</div>
218268
<!--menu-->
219269
<div id="menu" class="py-[80px]">
220-
<SectionTitle value="Menu" />
270+
<SectionTitle :props="{ id: 'menuTitle', value: 'Menu' }" />
221271
<div class="flex justify-center mt-[50px]">
222272
<div class="inline-block">
223273
<div class="grid grid-cols-1 lg:grid-cols-2 gap-10">
224274
<!--cut menu-->
225275
<div class="max-w-[470px]">
226276
<div class="bg-[#DED5D0] px-5 py-2 mb-5">
227-
<h2 class="text-main" :style="{ fontFamily: 'Jost, sans-serif' }">
277+
<h2
278+
class="menu-card text-main"
279+
:style="{ fontFamily: 'Jost, sans-serif' }"
280+
>
228281
Cut Menu(シャンプー・ブロー付き)
229282
</h2>
230283
</div>
231284
<div
232285
v-for="{ name: name, price: price } in menuData?.contents.filter(
233286
(x) => x.attr.includes('Cut Menu')
234287
)"
235-
class="flex justify-between text-main px-3 py-3"
288+
class="menu-card flex justify-between text-main px-3 py-3"
236289
>
237290
<p class="inline-block text-sm sm:text-base">
238291
{{ name }}
@@ -244,15 +297,18 @@ const styles = {
244297
<!--other menu-->
245298
<div class="max-w-[470px]">
246299
<div class="bg-[#DED5D0] px-5 py-2 mb-5">
247-
<h2 class="text-main" :style="{ fontFamily: 'Jost, sans-serif' }">
300+
<h2
301+
class="menu-card text-main"
302+
:style="{ fontFamily: 'Jost, sans-serif' }"
303+
>
248304
Other Menu
249305
</h2>
250306
</div>
251307
<div
252308
v-for="{ name: name, price: price } in menuData?.contents.filter(
253309
(x) => x.attr.includes('Other Menu')
254310
)"
255-
class="flex justify-between text-main px-3 py-3"
311+
class="menu-card flex justify-between text-main px-3 py-3"
256312
>
257313
<p class="inline-block text-sm sm:text-base">
258314
{{ name }}
@@ -267,7 +323,7 @@ const styles = {
267323
</div>
268324
<!--stylist-->
269325
<div id="stylist" class="bg-[#F1EAE5] py-[80px]">
270-
<SectionTitle value="Stylist" />
326+
<SectionTitle :props="{ id: 'stylistTitle', value: 'Stylist' }" />
271327
<div class="relative max-w-[800px] h-[700px] sm:h-[580px] mt-[50px] m-auto">
272328
<img
273329
id="stylistImg"
@@ -312,7 +368,7 @@ const styles = {
312368
</div>
313369
<!--access-->
314370
<div class="py-[80px]">
315-
<SectionTitle value="Access" />
371+
<SectionTitle :props="{ id: 'accessTitle', value: 'Access' }" />
316372
<div
317373
class="block md:flex max-w-[980px] border border-[#503528] p-[20px] mt-[40px] ms-3 me-3 md:ms-auto md:me-auto"
318374
>

0 commit comments

Comments
 (0)
Please sign in to comment.