1+ const defaultState = {
2+ background : "transparent" ,
3+ opacity : 1 ,
4+ x : 0 ,
5+ y : 0 ,
6+ scale : 1 ,
7+ backgroundSize : "100% 100%" ,
8+ backgroundPosition : "0 0" ,
9+ } ;
10+
111const none = {
212 initial : {
3- background : "transparent" ,
13+ ... defaultState ,
414 } ,
515 animate : {
6- background : "transparent" ,
16+ ... defaultState ,
717 } ,
818} ;
919
1020const highlight = {
1121 initial : {
12- background : `linear-gradient(to right,
13- #BFBFFF70 0%,
14- #BFBFFF70 0%,
15- transparent 0%,
16- transparent 100%
17- )` ,
22+ ...defaultState ,
23+ background : `linear-gradient(to right,
24+ #BFBFFF70 0%,
25+ #BFBFFF70 0%,
26+ transparent 0%,
27+ transparent 100%
28+ )` ,
1829 } ,
1930 animate : {
20- background : `linear-gradient(to right,
21- #BFBFFF70 0%,
22- #BFBFFF70 100%,
23- transparent 100%,
24- transparent 100%
25- )` ,
31+ ...defaultState ,
32+ background : `linear-gradient(to right,
33+ #BFBFFF70 0%,
34+ #BFBFFF70 100%,
35+ transparent 100%,
36+ transparent 100%
37+ )` ,
2638 transition : {
2739 duration : 1 ,
2840 ease : "linear" ,
2941 } ,
3042 } ,
3143} ;
3244
33- const gradation = {
45+ const rainbow = {
3446 initial : {
47+ ...defaultState ,
3548 background : `linear-gradient(to right,
36- #BFBFFF 0%,
37- #B0E2FF 50%,
38- #FFE4E1 100%
49+ #BFBFFF 0%,
50+ #B0E2FF 50%,
51+ #FFE4E1 100%
3952 )` ,
4053 backgroundSize : "300% 100%" ,
4154 backgroundPosition : "100% 0" ,
4255 } ,
4356 animate : {
57+ ...defaultState ,
4458 background : [
4559 `linear-gradient(to right,
4660 #BFBFFF 0%,
@@ -63,6 +77,7 @@ const gradation = {
6377 #FFE4E1 100%
6478 )` ,
6579 ] ,
80+ backgroundSize : "300% 100%" ,
6681 transition : {
6782 duration : 3 ,
6883 ease : "linear" ,
@@ -72,8 +87,110 @@ const gradation = {
7287 } ,
7388} ;
7489
90+ const fadeIn = {
91+ initial : {
92+ ...defaultState ,
93+ opacity : 0 ,
94+ } ,
95+ animate : {
96+ ...defaultState ,
97+ opacity : 1 ,
98+ transition : {
99+ duration : 1 ,
100+ ease : "easeOut" ,
101+ } ,
102+ } ,
103+ } ;
104+
105+ const slideIn = {
106+ initial : {
107+ ...defaultState ,
108+ x : - 20 ,
109+ opacity : 0 ,
110+ } ,
111+ animate : {
112+ ...defaultState ,
113+ x : 0 ,
114+ opacity : 1 ,
115+ transition : {
116+ duration : 0.5 ,
117+ ease : "easeOut" ,
118+ } ,
119+ } ,
120+ } ;
121+
122+ const pulse = {
123+ initial : {
124+ ...defaultState ,
125+ scale : 1 ,
126+ } ,
127+ animate : {
128+ ...defaultState ,
129+ scale : [ 1 , 1.02 , 1 ] ,
130+ transition : {
131+ duration : 1.5 ,
132+ ease : "easeInOut" ,
133+ repeat : Infinity ,
134+ } ,
135+ } ,
136+ } ;
137+
138+ const gradation = {
139+ initial : {
140+ ...defaultState ,
141+ background : `linear-gradient(
142+ 90deg,
143+ rgba(255,255,255,0) 0%,
144+ #BFBFFF80 70%,
145+ rgba(255,255,255,0) 100%
146+ )` ,
147+ backgroundSize : "200% 100%" ,
148+ backgroundPosition : "100% 0" ,
149+ } ,
150+ animate : {
151+ ...defaultState ,
152+ background : `linear-gradient(
153+ 90deg,
154+ rgba(255,255,255,0) 0%,
155+ #BFBFFF80 70%,
156+ rgba(255,255,255,0) 100%
157+ )` ,
158+ backgroundSize : "200% 100%" ,
159+ backgroundPosition : [ "100% 0" , "-100% 0" ] ,
160+ transition : {
161+ duration : 2 ,
162+ ease : "linear" ,
163+ repeat : Infinity ,
164+ } ,
165+ } ,
166+ } ;
167+
168+ const bounce = {
169+ initial : {
170+ ...defaultState ,
171+ y : 0 ,
172+ } ,
173+ animate : {
174+ ...defaultState ,
175+ y : [ - 2 , 2 , - 2 ] ,
176+ transition : {
177+ duration : 1 ,
178+ ease : "easeInOut" ,
179+ repeat : Infinity ,
180+ } ,
181+ } ,
182+ } ;
183+
75184export const blockAnimation = {
76185 none,
77186 highlight,
187+ rainbow,
188+ fadeIn,
189+ slideIn,
190+ pulse,
78191 gradation,
192+ bounce,
79193} ;
194+
195+ // types.ts
196+ export type AnimationType = keyof typeof blockAnimation ;
0 commit comments