A loader component from Aceternity UI.
From Aceternity UI
1"use client";
2import { motion } from "motion/react";
3import React from "react";
4
5export const LoaderOne = () => {
6 const transition = (x: number) => {
7 return {
8 duration: 1,
9 repeat: Infinity,
10 repeatType: "loop" as const,
11 delay: x * 0.2,
12 ease: "easeInOut" as const,
13 };
14 };
15 return (
16 <div className="flex items-center gap-2">
17 <motion.div
18 initial={{
19 y: 0,
20 }}
21 animate={{
22 y: [0, 10, 0],
23 }}
24 transition={transition(0)}
25 className="h-4 w-4 rounded-full border border-neutral-300 bg-gradient-to-b from-neutral-400 to-neutral-300"
26 />
27 <motion.div
28 initial={{
29 y: 0,
30 }}
31 animate={{
32 y: [0, 10, 0],
33 }}
34 transition={transition(1)}
35 className="h-4 w-4 rounded-full border border-neutral-300 bg-gradient-to-b from-neutral-400 to-neutral-300"
36 />
37 <motion.div
38 initial={{
39 y: 0,
40 }}
41 animate={{
42 y: [0, 10, 0],
43 }}
44 transition={transition(2)}
45 className="h-4 w-4 rounded-full border border-neutral-300 bg-gradient-to-b from-neutral-400 to-neutral-300"
46 />
47 </div>
48 );
49};
50
51export const LoaderTwo = () => {
52 const transition = (x: number) => {
53 return {
54 duration: 2,
55 repeat: Infinity,
56 repeatType: "loop" as const,
57 delay: x * 0.2,
58 ease: "easeInOut" as const,
59 };
60 };
61 return (
62 <div className="flex items-center">
63 <motion.div
64 transition={transition(0)}
65 initial={{
66 x: 0,
67 }}
68 animate={{
69 x: [0, 20, 0],
70 }}
71 className="h-4 w-4 rounded-full bg-neutral-200 shadow-md dark:bg-neutral-500"
72 />
73 <motion.div
74 initial={{
75 x: 0,
76 }}
77 animate={{
78 x: [0, 20, 0],
79 }}
80 transition={transition(0.4)}
81 className="h-4 w-4 -translate-x-2 rounded-full bg-neutral-200 shadow-md dark:bg-neutral-500"
82 />
83 <motion.div
84 initial={{
85 x: 0,
86 }}
87 animate={{
88 x: [0, 20, 0],
89 }}
90 transition={transition(0.8)}
91 className="h-4 w-4 -translate-x-4 rounded-full bg-neutral-200 shadow-md dark:bg-neutral-500"
92 />
93 </div>
94 );
95};
96
97export const LoaderThree = () => {
98 return (
99 <motion.svg
100 xmlns="http://www.w3.org/2000/svg"
101 width="24"
102 height="24"
103 viewBox="0 0 24 24"
104 fill="none"
105 stroke="currentColor"
106 strokeWidth="1"
107 strokeLinecap="round"
108 strokeLinejoin="round"
109 className="h-20 w-20 stroke-neutral-500 [--fill-final:var(--color-yellow-300)] [--fill-initial:var(--color-neutral-50)] dark:stroke-neutral-100 dark:[--fill-final:var(--color-yellow-500)] dark:[--fill-initial:var(--color-neutral-800)]"
110 >
111 <motion.path stroke="none" d="M0 0h24v24H0z" fill="none" />
112 <motion.path
113 initial={{ pathLength: 0, fill: "var(--fill-initial)" }}
114 animate={{ pathLength: 1, fill: "var(--fill-final)" }}
115 transition={{
116 duration: 2,
117 ease: "easeInOut" as const,
118 repeat: Infinity,
119 repeatType: "reverse",
120 }}
121 d="M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"
122 />
123 </motion.svg>
124 );
125};
126
127export const LoaderFour = ({ text = "Loading..." }: { text?: string }) => {
128 return (
129 <div className="relative font-bold text-black [perspective:1000px] dark:text-white">
130 <motion.span
131 animate={{
132 skewX: [0, -40, 0],
133 scaleX: [1, 2, 1],
134 }}
135 transition={{
136 duration: 0.05,
137 repeat: Infinity,
138 repeatType: "reverse",
139 repeatDelay: 2,
140 ease: "linear" as const,
141 times: [0, 0.2, 0.5, 0.8, 1],
142 }}
143 className="relative z-20 inline-block"
144 >
145 {text}
146 </motion.span>
147 <motion.span
148 className="absolute inset-0 text-[#00e571]/50 blur-[0.5px] dark:text-[#00e571]"
149 animate={{
150 x: [-2, 4, -3, 1.5, -2],
151 y: [-2, 4, -3, 1.5, -2],
152 opacity: [0.3, 0.9, 0.4, 0.8, 0.3],
153 }}
154 transition={{
155 duration: 0.5,
156 repeat: Infinity,
157 repeatType: "reverse",
158 ease: "linear" as const,
159 times: [0, 0.2, 0.5, 0.8, 1],
160 }}
161 >
162 {text}
163 </motion.span>
164 <motion.span
165 className="absolute inset-0 text-[#8b00ff]/50 dark:text-[#8b00ff]"
166 animate={{
167 x: [0, 1, -1.5, 1.5, -1, 0],
168 y: [0, -1, 1.5, -0.5, 0],
169 opacity: [0.4, 0.8, 0.3, 0.9, 0.4],
170 }}
171 transition={{
172 duration: 0.8,
173 repeat: Infinity,
174 repeatType: "reverse",
175 ease: "linear" as const,
176 times: [0, 0.3, 0.6, 0.8, 1],
177 }}
178 >
179 {text}
180 </motion.span>
181 </div>
182 );
183};
184
185export const LoaderFive = ({ text }: { text: string }) => {
186 return (
187 <div className="font-sans font-bold [--shadow-color:var(--color-neutral-500)] dark:[--shadow-color:var(--color-neutral-100)]">
188 {text.split("").map((char, i) => (
189 <motion.span
190 key={i}
191 className="inline-block"
192 initial={{ scale: 1, opacity: 0.5 }}
193 animate={{
194 scale: [1, 1.1, 1],
195 textShadow: [
196 "0 0 0 var(--shadow-color)",
197 "0 0 1px var(--shadow-color)",
198 "0 0 0 var(--shadow-color)",
199 ],
200 opacity: [0.5, 1, 0.5],
201 }}
202 transition={{
203 duration: 0.5,
204 repeat: Infinity,
205 repeatType: "loop",
206 delay: i * 0.05,
207 ease: "easeInOut" as const,
208 repeatDelay: 2,
209 }}
210 >
211 {char === " " ? "\u00A0" : char}
212 </motion.span>
213 ))}
214 </div>
215 );
216};
217