mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 13:43:59 -05:00
77 lines
1.6 KiB
TypeScript
77 lines
1.6 KiB
TypeScript
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>
|
|
);
|
|
}
|