Most simple components created
This commit is contained in:
76
lib/component/loading/dot/BouncingDots.tsx
Normal file
76
lib/component/loading/dot/BouncingDots.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { LoadingDotsProps } from "$/types/Loading";
|
||||
|
||||
|
||||
export default function BouncingDots({
|
||||
width,
|
||||
height,
|
||||
className,
|
||||
animationDuration = 0.6,
|
||||
stroke,
|
||||
fill
|
||||
}: LoadingDotsProps){
|
||||
//https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-smil/3-dots-bounce.svg?short_path=50864c0
|
||||
const id = crypto.randomUUID().replaceAll("-", "");
|
||||
|
||||
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<circle
|
||||
cx="4"
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
>
|
||||
<animate
|
||||
id={`firstBouncingDots_${id}`}
|
||||
begin={`0;lastBouncingDots_${id}.end+${animationDuration / 2}s`}
|
||||
attributeName="cy"
|
||||
calcMode="spline"
|
||||
dur={animationDuration}
|
||||
values="12;6;12"
|
||||
keySplines=".33,.66,.66,1;.33,0,.66,.33"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
>
|
||||
<animate
|
||||
id={`secondBouncingDots_${id}`}
|
||||
begin={`firstBouncingDots_${id}.begin+${animationDuration / 5}s`}
|
||||
attributeName="cy"
|
||||
calcMode="spline"
|
||||
dur={animationDuration}
|
||||
values="12;6;12"
|
||||
keySplines=".33,.66,.66,1;.33,0,.66,.33"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="20"
|
||||
cy="12"
|
||||
r="3"
|
||||
className={className}
|
||||
stroke={stroke}
|
||||
>
|
||||
<animate
|
||||
id={`lastBouncingDots_${id}`}
|
||||
begin={`secondBouncingDots_${id}.begin+${animationDuration / 5}s`}
|
||||
attributeName="cy"
|
||||
calcMode="spline"
|
||||
dur={animationDuration}
|
||||
values="12;6;12"
|
||||
keySplines=".33,.66,.66,1;.33,0,.66,.33"
|
||||
/>
|
||||
</circle>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user